class CartController extends Controller { public function cart(Product $product) { Auth::user()->carts()->create([ 'product_id' => $product->id, ]); Flasher::addSuccess('Product Added to the Cart Created Successfully!'); return redirect()->back(); } }
Thanks! Keep them coming
Glad you upload so often
Buenos sus videos.
add to cart button not redirecting me to login page if im not login
Sir upload employee management systems how to create in ir way simple.. pls upload
Stop pasting and create it on your own.
class CartController extends Controller
{
public function cart(Product $product)
{
Auth::user()->carts()->create([
'product_id' => $product->id,
]);
Flasher::addSuccess('Product Added to the Cart Created Successfully!');
return redirect()->back();
}
}