app/Http/Controllers/HomeController.php
/**
     * Show the application dashboard to the user.
     *
     * @return Application|Factory|View
     */
Show the application dashboard to the user.
@return Application|Factory|View
Show the application dashboard to the user . @return Application|Factory|View
public function index()
    {
        $Friends = Friend::where('user_id',Auth::user()->id)->pluck('friend_id')->toArray();
        (!in_array(Auth::user()->id,$Friends))?array_push($Friends,Auth::user()->id): "";
        $PeopleYouMayKnow = User::whereNotIn('id',$Friends)->take(4)->get();
        $Posts = Post::whereIn('user_id',$Friends)->orderBy('created_at','desc')->get();
        return view('home',compact('PeopleYouMayKnow','Posts'));
    }
public function index ( ) { $ Friends = Friend :: where ( 'user_id' , Auth :: user ( ) -> id ) -> pluck ( 'friend_id' ) -> toArray ( ) ; ( ! in_array ( Auth :: user ( ) -> id , $ Friends ) ) ? array_push ( $ Friends , Auth :: user ( ) -> id ) : " " ; $ PeopleYouMayKnow = User :: whereNotIn ( 'id' , $ Friends ) -> take ( 4 ) -> get ( ) ; $ Posts = Post :: whereIn ( 'user_id' , $ Friends ) -> orderBy ( 'created_at' , 'desc' ) -> get ( ) ; return view ( 'home' , compact ( 'PeopleYouMayKnow' , 'Posts' ) ) ; }
Show the application dashboard to the user.
Show the application dashboard to the user .