mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 00:03:16 +00:00
Update SiteController
This commit is contained in:
parent
14be898431
commit
326a1b353a
1 changed files with 34 additions and 16 deletions
|
@ -2,16 +2,10 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App;
|
||||
use App\Follower;
|
||||
use App\Profile;
|
||||
use App\Status;
|
||||
use App\User;
|
||||
use App\UserFilter;
|
||||
use App\Util\Lexer\PrettyNumber;
|
||||
use Auth;
|
||||
use Cache;
|
||||
use Illuminate\Http\Request;
|
||||
use App, Auth, Cache, View;
|
||||
use App\Util\Lexer\PrettyNumber;
|
||||
use App\{Follower, Page, Profile, Status, User, UserFilter};
|
||||
|
||||
class SiteController extends Controller
|
||||
{
|
||||
|
@ -47,18 +41,42 @@ class SiteController extends Controller
|
|||
|
||||
public function about()
|
||||
{
|
||||
$stats = Cache::remember('site:about:stats', 1440, function() {
|
||||
return [
|
||||
'posts' => Status::whereLocal(true)->count(),
|
||||
'users' => User::count(),
|
||||
'admin' => User::whereIsAdmin(true)->first()
|
||||
];
|
||||
$res = Cache::remember('site:about', 120, function() {
|
||||
$custom = Page::whereSlug('/site/about')->whereActive(true)->exists();
|
||||
if($custom) {
|
||||
$stats = Cache::remember('site:about:stats', 60, function() {
|
||||
return [
|
||||
'posts' => Status::whereLocal(true)->count(),
|
||||
'users' => User::count(),
|
||||
'admin' => User::whereIsAdmin(true)->first()
|
||||
];
|
||||
});
|
||||
return View::make('site.about')->with('stats', $stats)->render();
|
||||
} else {
|
||||
$stats = Cache::remember('site:about:stats', 60, function() {
|
||||
return [
|
||||
'posts' => Status::whereLocal(true)->count(),
|
||||
'users' => User::count(),
|
||||
'admin' => User::whereIsAdmin(true)->first()
|
||||
];
|
||||
});
|
||||
//return view('site.about', compact('stats'));
|
||||
return View::make('site.about')->with('stats', $stats)->render();
|
||||
}
|
||||
});
|
||||
return view('site.about', compact('stats'));
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function language()
|
||||
{
|
||||
return view('site.language');
|
||||
}
|
||||
|
||||
public function communityGuidelines(Request $request)
|
||||
{
|
||||
$slug = '/site/kb/community-guidelines';
|
||||
$page = Page::whereSlug($slug)->whereActive(true)->first();
|
||||
return view('site.help.community-guidelines', compact('page'));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue