Ejemplo n.º 1
0
 public function index()
 {
     $posts = Post::join('users', 'users.id', '=', 'posts.user_id')->select()->orderBy('posts.id', 'desc')->get();
     $numTuits = Post::where('user_id', '=', Auth::user()->id)->count();
     $follows = DB::table('seguidores')->where('user_id', '=', Auth::user()->id)->count();
     $followers = DB::table('seguidores')->where('follow_to', '=', Auth::user()->id)->count();
     $rndUser = User::select()->count();
     $random = rand(1, $rndUser);
     $userFollow = User::find($random);
     return view('index')->with(compact('numTuits', 'posts', 'follows', 'followers', 'userFollow'));
 }