|
|
|
@ -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'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|