user()->id; $wishlist = Wishlist::where('user_id', $userId)->whereNull('deleted_at')->get(); } else { // Otherwise, fetch the user_id from $username and their wishlist items. $userId = User::whereUsername($username)->firstOrFail()->id; $wishlist = Wishlist::where('user_id', $userId)->get(); } // Direct the user to the wishlist page. return view('pages.wishlist.index', compact('wishlist')); } /** * Show the form for editing the specified resource. * * @param \App\Models\Wishlist $wishlist * @return \Illuminate\Http\Response */ public function edit(Wishlist $wishlist) { // } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param \App\Models\Wishlist $wishlist * @return \Illuminate\Http\Response */ public function update(Request $request, Wishlist $wishlist) { // } /** * Remove the specified resource from storage. * * @param \App\Models\Wishlist $wishlist * @return \Illuminate\Http\Response */ public function destroy(Wishlist $wishlist) { // } }