コード例 #1
0
 public function index()
 {
     $users = User::count();
     $posts = Post::count();
     $categories = Category::count();
     $comments = Comment::count();
     return $this->view('gag/admin/dashboard/index', ['users' => $users, 'posts' => $posts, 'categories' => $categories, 'comments' => $comments]);
 }
コード例 #2
0
 public function loadCategories()
 {
     $categories = null;
     if (\Cache::has(Category::cache_key)) {
         $categories = \Cache::get(Category::cache_key);
     } else {
         $categories = \Cache::rememberForever(Category::cache_key, function () {
             return Category::lists('title', 'slug');
         });
     }
     \View::share('app_categories', $categories);
 }