(Update) User Online Block

- optimize queries + cleanup view
This commit is contained in:
HDVinnie
2018-11-11 16:57:50 -05:00
parent a8221d0bd7
commit 8631b15836
2 changed files with 37 additions and 30 deletions
+8 -9
View File
@@ -33,7 +33,7 @@ class HomeController extends Controller
*/
public function home()
{
// Latest Articles Block
// Latest Articles/News Block
$articles = Article::latest()->take(1)->get();
// Latest Torrents Block
@@ -49,18 +49,18 @@ class HomeController extends Controller
// Latest Posts Block
$posts = Post::latest()->take(5)->get();
//Online Block
$user = User::oldest('username')->get();
$groups = Group::oldest('position')->get();
// Online Block
$users = User::with('group')->oldest('username')->get();
$groups = Group::select(['name', 'color', 'effect', 'icon'])->oldest('position')->get();
//Featured Torrents
// Featured Torrents
$featured = FeaturedTorrent::with('torrent')->get();
//Latest Poll
// Latest Poll
$poll = Poll::latest()->first();
return view('home.home', [
'user' => $user,
'users' => $users,
'groups' => $groups,
'articles' => $articles,
'torrents' => $torrents,
@@ -71,8 +71,7 @@ class HomeController extends Controller
'topics' => $topics,
'posts' => $posts,
'featured' => $featured,
'poll' => $poll,
'poll' => $poll
]);
}
}