From 794cf80c1576572fda7c7f43415e543fb99e8217 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 4 Dec 2018 13:46:07 -0700 Subject: [PATCH] Update about page with stats and instance admin --- app/Http/Controllers/SiteController.php | 9 +++++++- resources/views/site/about.blade.php | 30 ++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/SiteController.php b/app/Http/Controllers/SiteController.php index d1274b9dc..d7ab96480 100644 --- a/app/Http/Controllers/SiteController.php +++ b/app/Http/Controllers/SiteController.php @@ -68,7 +68,14 @@ class SiteController extends Controller public function about() { - return view('site.about'); + $stats = Cache::remember('site:about:stats', 1440, function() { + return [ + 'posts' => Status::whereLocal(true)->count(), + 'users' => User::count(), + 'admin' => User::whereIsAdmin(true)->first() + ]; + }); + return view('site.about', compact('stats')); } public function language() diff --git a/resources/views/site/about.blade.php b/resources/views/site/about.blade.php index 765b775b8..76b8bd7a4 100644 --- a/resources/views/site/about.blade.php +++ b/resources/views/site/about.blade.php @@ -9,7 +9,7 @@
-
+
@@ -33,6 +33,34 @@
+
+
+
+

{{$stats['posts']}}

+

Posts

+
+
+ +
+
+

{{$stats['users']}}

+

Users

+
+
+ + @if($stats['admin']) +
+
+

+ + @{{$stats['admin']->username}} + +

+

Instance Admin

+
+
+ @endif +