Exemplo n.º 1
0
 public function rankings()
 {
     //Top 10 usuarios
     $top10user = UserProfile::orderBy('points', 'desc')->take(10)->get();
     //Top 10 mejores publicaciones - Todo el tiempo
     $top10post = Post::orderBy('point', 'desc')->take(10)->get();
     //Top 10 mejores publicaciones - Mes
     $top10month = Post::where('created_at', '>=', new DateTime('-1 months'))->orderBy('point', 'desc')->take(10)->get();
     //Top 10 mejores publicaciones - Mes
     $top10week = Post::where('created_at', '>=', new DateTime('-1 weeks'))->orderBy('point', 'desc')->take(10)->get();
     return View::make('ranking', ['top10user' => $top10user, 'top10post' => $top10post, 'top10month' => $top10month, 'top10week' => $top10week]);
 }