jeudi 24 juin 2021

Laravel Model binding resource 404 error on show, edit ,delete parameter

I have a model Category and CategoriesController resource and in my web route I have:

Route::group(['prefix' => 'admin', 'as' => 'admin.', 'namespace' => 'Admin', 'middleware' => ['auth']], function () {

    Route::resource('comments', 'CommentsController');


    // Categories
    Route::delete('categories/destroy', 'CategoriesController@massDestroy')->name('categories.massDestroy');

    Route::resource('categories', 'CategoriesController');

});

but only works with index and create the others edit, delete shows 404 , my routes list is this:

enter image description here

Example,I try to show the category 5 like this:

  public function show(Category $category)
{
   
    dd($category);
    return view('admin.categories.show', compact('category'));
}

but I get 404 error only in show, edit, delete.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire