/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $authID = \Auth::user()->id; $stories = story::where('user_id', $id)->get(); $profile = user::where('id', $id)->get(); $thisProfiel = user::where('id', $id)->get()->first(); // explore trip I made $explore = Expedition::where('user_id', $id)->get(); // explore trips where I'm invite too $invexplore = Expfriend::select('expedition_id')->where('user_id', $id)->get(); $invexplore = $invexplore->lists('expedition_id'); $invexploration = Expedition::whereIn('id', $invexplore)->get(); //my friends $listfriends = friend::select('friend_id')->where('user_id', $id)->where('state', 1)->get(); $listfriends = $listfriends->lists('friend_id'); $friends = user::whereIn('id', $listfriends)->get(); //my invited for friends $notmyfriends = friend::select('user_id')->where('friend_id', $id)->where('state', 0)->get(); $notmyfriends = $notmyfriends->lists('user_id'); $invitefriends = user::whereIn('id', $notmyfriends)->get(); if ($id == $authID) { $isthisme = "yes"; } else { $isthisme = "no"; } return view('profile.index', compact('stories', 'isthisme', 'friends', 'invitefriends', 'thisProfiel', 'explore', 'invexploration')); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $state = 'off'; $story = story::find($id); $parts = part::where('story_id', $id)->get(); $reader = \Auth::user()->id; $author = story::where('id', $id)->pluck('user_id'); if ($author == $reader) { $isthisme = "yes"; } else { $isthisme = "no"; } $author = user::where('id', $author)->get()->first(); return view('story.read', compact('state', 'reader', 'parts', 'story', 'isthisme', 'author')); }
/** * Show the form for creating a new resource. * * @return Response */ public function create($id) { $story = $id; $storydata = story::where('id', '=', $story)->first(); return view('parts.create', compact('storydata')); }