Ejemplo n.º 1
0
 /**
  * Show the application dashboard.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $user = auth()->user();
     $followingIds = $user->followers()->lists('follows.follower_id');
     $followingIds->push($user->id);
     $activities = Activity::userIds($followingIds)->latest()->paginate(15);
     $activities->load('user');
     $learnedWords = $user->learnedWords()->count();
     $followers = $user->followees()->notAdmin()->count();
     $following = $user->followers()->notAdmin()->count();
     return view('home')->with('user', $user)->with('activities', $activities)->with('followers', $followers)->with('following', $following)->with('learnedWords', $learnedWords);
 }