John Davidson

php - remove products from the cart using laravel in e-commerce project

0 comments
Message:


this is the code of my ProductController.php


function removeCart($id)
{
Cart::destroy($id);
return redirect('cartlist');
}

this is my route in web.php


Route::get("removecart/{id}",[ProductController::class,'removeCart'])->name('remove'); 

this is my balde file code


<a href="{{url('/removecart/{$item->cart_id}')}}" class="btn btn-warning" >Remove from Cart</a>

my remove from cart button is not working



My Answer:
'/removecart/{id}', 'ProductController@removeCart');

Rate this post

5 of 5 based on 3464 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us