/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $users = User::find($id); $apartment = Apartment::findOrFail($users->profile->defaultApartment); $prof = $apartment->profiles()->where('profile_id', '=', $users->profile->id)->first(); // fetches profile_id from pivot table return view('apartmentadmin.show', compact('users', 'prof')); }