david19
2 months ago
266
11
Laravel

Allways DELETE last record

Posted 2 months ago by david19

Hello Team. I dont know what is the mistake. I will delete a category by id, but it allways delete my last record in the database.

Route::Delete('/admin/shop/category/{category}/destroy','Shop\Category\[email protected]')->name('admin.shop.category.destroy');
public function destroy($id)
    {
      $category = Category::find($id);
Category::destroy($id);

      return redirect(route('admin.shop.category.index'))->with('error', 'Category removed');
    }
<form method="POST" action="{{ route('admin.shop.category.destroy',$category->id )}}">
  @method('DELETE')
  @csrf
<input type="submit" class="btn btn-danger float-right" value="Delete">
</form>

I dont see any mistakes :(

Please sign in or create an account to participate in this conversation.