Example #1
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $posts_published = Post::published()->count();
     $posts_editing = Post::where('published', 'uc')->count();
     $posts_sticky = Post::where('is_sticky', 'on')->count();
     $posts = Post::count();
     $users = User::count();
     $jobs = Job::count();
     $questions = Question::count();
     $categories = Category::count();
     return view('admin.stats.index', compact('posts', 'posts_published', 'posts_sticky', 'posts_editing', 'users', 'jobs', 'questions', 'categories'));
 }
 public function getStats()
 {
     $stats = [['title' => 'Jobs', 'value' => \App\Job::count()], ['title' => 'Featured Jobs', 'value' => \App\Job::where(['featured_flag' => 1])->count()], ['title' => 'Companies', 'value' => \App\Company::count()], ['title' => 'Featured Companies', 'value' => \App\Company::where(['is_promoted' => 1])->count()], ['title' => 'Ads', 'value' => \App\Ad::count()], ['title' => 'General ads', 'value' => \App\AdGeneral::count()]];
     return response()->json($stats);
 }