I have a problem in laravel to see this:

help me please.
NoticeCommentController.php:
public function destroy(NoticeComment $noticeComment)
{
$noticeComment->delete();
}
but this is not working..
Argument 1 passed to App\Http\Controllers\NoticeCommentController::destroy() must be an instance of App\NoticeComment, instance of App\Notice given
what is problem..?
my code in github : https://github.com/jonsoku/homepage2
Change to this
public function destroy(Notice $notice, NoticeComment $noticeComment)
{
$noticeComment->delete();
}
when you defined nested resource like this
Route::resource('notices.noticeComments', 'NoticeCommentController');
your route going to be something like this
notices/{notice}/noticeComments/{noticeComment}
So your first parameter is going to be Notice and second param is NoticeComment, hope it help.
You can read more here https://laravel.com/docs/5.1/controllers#restful-nested-resources
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With