Пример #1
0
 public function logedIn(Request $request)
 {
     if ($request->user()) {
         $user = $request->user();
         $firendsList = Friend::where('user_id', '=', $user->id)->get();
         $friends = array();
         foreach ($firendsList as $friend) {
             $x = User::find($friend->friend_id);
             array_push($friends, $x);
         }
         return view('pages.home', ['user' => $user, 'friends' => $friends]);
     }
 }
Пример #2
0
 public function userEdit($id, Request $request)
 {
     $user = $request->user();
     $firendsList = Friend::where('user_id', '=', $user->id)->get();
     $friends = array();
     foreach ($firendsList as $friend) {
         $x = User::find($friend->friend_id);
         array_push($friends, $x);
     }
     if ($user->id == $id) {
         return view('pages.useredit', ['user' => $user, 'friends' => $friends]);
     } else {
         return redirect('../home');
     }
 }