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!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire