samedi 22 août 2020

Too few arguments to function App\Http\Controllers\CartController::destroy(), 0 passed and exactly 1 expected

Am using darryldecode ShoppingCart library but I keep getting the above error when am trying to remove an item from my cart, I don't know what am missing. Here is my code below.

public function destroy($id)
{
    Cart::remove($id);
    return redirect()->back();
}

This is my route.

Route::delete('/cart', 'CartController@destroy')->name('cart.destroy');

And here is my view

<form action="" method="POST">
    @csrf
    
    <button type="submit" class="btn btn-link mr-2" style="color: gray">Remove</button>
</form>

What am I missing? Thanks for your concern!



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3l4XY0t
via IFTTT

Aucun commentaire:

Enregistrer un commentaire