/** * 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')); }
/** * @test */ public function an_expedition_gallery_is_automatically_created_when_an_expedition_is_created() { $expedition = factory(App\Expedition::class)->make(); $this->asAnAdminUser(); $this->visit('/admin/expeditions/create')->submitForm('Create Expedition', ['name' => $expedition->name, 'location' => $expedition->location, 'start_date' => '1982-05-20', 'about' => 'about', 'objectives' => 'objectives', 'mission' => 'mission', 'donation_goal' => 'R1000'])->seeInDatabase('expeditions', ['name' => $expedition->name, 'location' => $expedition->location]); $newExpedition = \App\Expedition::where('name', $expedition->name)->firstOrFail(); $this->assertGreaterThan(0, $newExpedition->galleries->count(), 'should be at least one gallery'); }