Answer the question
In order to leave comments, you need to log in
Why the category is not removed and writes 404?
public function destroy($id)
{
$category = Category::find($id);
$category->delete();
return redirect('/categories')->with('a', "Категория номер $id удалёна");
}
Route::get("/categories/category/destroy/{category}", "[email protected]");
<a href="/categories/category/delete/{{$category->id}}" class="card-link">удалить</a>
Answer the question
In order to leave comments, you need to log in
get("/categories/category/destroy/{category}"
href="/categories/category/delete/{{$category->id}}"
Come on, eprst ... Try yourself in aeromodelling.
In your case, you need to
write
$category = new Category::find($id);
Category:::find($id)->delete();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question