diff --git a/app/Controllers/HomeController.php b/app/Controllers/HomeController.php index 62b4295..1eade3c 100644 --- a/app/Controllers/HomeController.php +++ b/app/Controllers/HomeController.php @@ -33,6 +33,7 @@ class HomeController extends Controller ->orderBy('user_id', 'desc') ->limit(1) ->get(['user_id']); + $newestUser = User::construct($newestUserId ? $newestUserId[0]->user_id : 0); // Get all the currently online users @@ -58,28 +59,27 @@ class HomeController extends Controller $onlineUsers[$user->id] = $user; } - //$news = new Category(config('general.news')); + $news = []; //new Category(config('general.news')); - Template::vars([ - 'news' => [], - 'stats' => [ - 'userCount' => DB::table('users') - ->where('rank_main', '!=', config('rank.banned')) - ->where('user_activated', 1) - ->where('user_restricted', 0) - ->count(), - 'newestUser' => $newestUser, - 'lastRegDate' => date_diff( - date_create(date('Y-m-d', $newestUser->registered)), - date_create(date('Y-m-d')) - )->format('%a'), - 'topicCount' => DB::table('topics')->where('forum_id', '!=', config('forum.trash'))->count(), - 'postCount' => DB::table('posts')->where('forum_id', '!=', config('forum.trash'))->count(), - 'onlineUsers' => $onlineUsers, - ], - ]); + $userCount = DB::table('users') + ->where('rank_main', '!=', config('rank.banned')) + ->where('user_activated', 1) + ->where('user_restricted', 0) + ->count(); - // Return the compiled page - return Template::render('meta/index'); + $lastRegDate = date_diff( + date_create(date('Y-m-d', $newestUser->registered)), + date_create(date('Y-m-d')) + )->format('%a'); + + $trashId = config('forum.trash'); + $topicCount = DB::table('topics') + ->where('forum_id', '!=', $trashId) + ->count(); + $postCount = DB::table('posts') + ->where('forum_id', '!=', $trashId) + ->count(); + + return view('home/index', compact('news', 'userCount', 'newestUser', 'lastRegDate', 'topicCount', 'postCount', 'onlineUsers')); } } diff --git a/resources/views/yuuno/meta/index.twig b/resources/views/yuuno/home/index.twig similarity index 80% rename from resources/views/yuuno/meta/index.twig rename to resources/views/yuuno/home/index.twig index f3aff0e..beabda5 100644 --- a/resources/views/yuuno/meta/index.twig +++ b/resources/views/yuuno/home/index.twig @@ -21,14 +21,14 @@ {% endif %}