if we are already logged in as admin and again perform artisan serve ....then after login as admin it is taking us to the url /dashboard.....every time i need to customize the url like admin/dashboard...please fix the issue☺
I am liking this tutorial so far. 2 things that are missing is updating the qty when added to cart and removing items from the cart. Will you add these?
To solve the attempt property on null you can use the nullsafe operator like $user_id = auth()?->user()?->id;
if we are already logged in as admin and again perform artisan serve ....then after login as admin it is taking us to the url /dashboard.....every time i need to customize the url like admin/dashboard...please fix the issue☺
I am liking this tutorial so far. 2 things that are missing is updating the qty when added to cart and removing items from the cart. Will you add these?
$products = Product::all();
$count = 0;
if (Auth::check()) {
$userId = Auth::user()->id;
$count = Cart::where('user_id', $userId)->count();
}
return view('front-end.index',compact('products', 'count'));