Example #1
0
 public function status($statusType)
 {
     if (1 == $statusType) {
         $buildingNumber = Building::count();
         $roomNumber = Room::count();
         $buildingRet = ['buildingNumber' => $buildingNumber, 'roomNumber' => $roomNumber];
         return $buildingRet;
     } else {
         if (2 == $statusType) {
             $roomNumber = Room::count();
             $rentedRoomNumber = Contract::count();
             $emptyRoomNumber = $roomNumber - $rentedRoomNumber;
             $rentRet = ['roomNumber' => $roomNumber, 'rentedNumber' => $rentedRoomNumber, 'emptyNumber' => $emptyRoomNumber];
             return $rentRet;
         } else {
             if (3 == $statusType) {
                 $feePlanItem = DB::select('SELECT COUNT(DISTINCT feemeta_id) as counts FROM fee_plans WHERE status=0 AND deleted_at IS NULL');
                 $feePlanRentNumber = DB::select('SELECT COUNT(DISTINCT rent_id) as counts FROM fee_plans WHERE status=0 AND deleted_at IS NULL');
                 $feeRet = ['feePlanNumber' => $feePlanItem[0]->counts, 'feePlanRentNumber' => $feePlanRentNumber[0]->counts];
                 return $feeRet;
             } else {
                 if (4 == $statusType) {
                     $userNumber = User::count();
                     $userRet = ['userCount' => $userNumber];
                     return $userRet;
                 }
             }
         }
     }
 }
Example #2
0
 /**
  * Get homepage
  *
  * @param Request $request
  * @return View|void
  */
 public function getHomepage(Request $request)
 {
     /**
      * Load data
      */
     $this->_arViewData = $this->_loadPageByUrl('/');
     /**
      * Number of users
      */
     $this->_arViewData['users_no'] = User::count() + 135000;
     /**
      * Number of campaigns
      */
     $this->_arViewData['campaigns_no'] = Campaign::count();
     /**
      * Number of payments total
      */
     $this->_arViewData['payments_no_total'] = Payment::sum('amount');
     /**
      * Number of payments last month
      */
     $this->_arViewData['payments_no_last_month'] = Payment::where('created_at', '>=', Carbon::now()->subMonth())->count();
     /**
      * Return view
      */
     return $this->_showViewOr404('frontend.homepage');
 }
Example #3
0
 public function index(ArticleRepository $article, MarketRepository $market)
 {
     $article_counts = $article->publishedCountWithCommentCount();
     $user_count = \App\User::count();
     $event_count = $market->currentAndFutureCount();
     return view('backend.page.index', compact('article_counts', 'user_count', 'event_count'));
 }
 public function challenges()
 {
     /*$game = Game::first();
             $categories = Category::get();
             $categories = $categories->toArray();
     
             foreach($categories as $category)
             {
                 $challenges = Challenge::where('category_id', $category['id'])->get()->toArray();
                 $categories[(int)$category['id'] - 1]['challenges'] =  $challenges;
             }
     
     
             $data = array('game' => $game, 'categories' => $categories);*/
     $num_users = User::count();
     $completed = Submitted_flag::count();
     $num_challenges = Challenge::count();
     $average_c = $completed / $num_users / $num_challenges * 100;
     $stats = array('num_users' => $num_users, 'completed' => $completed, 'average' => $average_c);
     $game = Game::first();
     $categories = Category::get();
     $categories = $categories->toArray();
     foreach ($categories as $category) {
         $challenges = Challenge::where('category_id', $category['id'])->get()->toArray();
         $categories[(int) $category['id'] - 1]['challenges'] = $challenges;
     }
     $directory = base_path() . '/public/Challenges_Repo/';
     $files = scandir($directory);
     $data = array('user' => Auth::user(), 'game' => $game, 'categories' => $categories, 'stats' => $stats, 'files' => $files);
     return view("pages.challenges")->with('data', $data);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $users_count = User::count();
     $posts_count = Post::count();
     $galleries_count = Gallery::count();
     return response()->json(['users_count' => $users_count, 'posts_count' => $posts_count, 'galleries_count' => $galleries_count]);
 }
 /**
  * Display a dashboard.
  *
  * @return Response
  */
 public function index()
 {
     $userCount = User::count();
     $pagesCount = Page::count();
     $newsCount = News::count();
     return view('util.index', compact('userCount', 'pagesCount', 'newsCount'));
 }
 public function index()
 {
     $title = "Dashboard";
     $users = User::count();
     $operation_areas = Operation_area::select()->get();
     return view('admin.dashboard.index', compact('title', 'users', 'operation_areas'));
 }
 /**
  * Display the dashboard once the user is logged
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $nb_users = User::count();
     $nb_posts = Post::count();
     $nb_pages = Page::count();
     return view('admin.admin', compact('nb_users', 'nb_posts', 'nb_pages'));
 }
 public function dashboard(Request $request)
 {
     $stat = new \Stdclass();
     $stat->num_ads = Ad::count();
     $stat->num_promo_ads = Ad::where('ad_promo', 1)->count();
     $stat->users = User::count();
     $stat->reports = AdReport::count();
     //get last 10 days ads
     $ads_by_date = Ad::select(DB::raw("count(ad_id) AS ad_count, DATE_FORMAT(ad_publish_date, '%Y-%m-%d') AS date_formated"))->groupBy('date_formated')->orderBy('date_formated', 'desc')->take(10)->get()->toArray();
     $stat->ads_by_date = [];
     if (!empty($ads_by_date)) {
         $stat->ads_by_date = array_reverse($ads_by_date);
     }
     //get last 10 promo days ads
     $promo_ads_by_date = Ad::select(DB::raw("count(ad_id) AS ad_count, DATE_FORMAT(ad_publish_date, '%Y-%m-%d') AS date_formated"))->where('ad_promo', 1)->groupBy('date_formated')->orderBy('date_formated', 'desc')->take(10)->get()->toArray();
     $stat->promo_ads_by_date = [];
     if (!empty($promo_ads_by_date)) {
         $stat->promo_ads_by_date = array_reverse($promo_ads_by_date);
     }
     //get last 10 months ads
     $ads_by_month = Ad::select(DB::raw("count(ad_id) AS ad_count, DATE_FORMAT(ad_publish_date, '%Y-%m') AS date_formated"))->groupBy('date_formated')->orderBy('date_formated', 'desc')->take(10)->get()->toArray();
     $stat->ads_by_month = [];
     if (!empty($ads_by_month)) {
         $stat->ads_by_month = array_reverse($ads_by_month);
     }
     //get last 10 years ads
     $ads_by_year = Ad::select(DB::raw("count(ad_id) AS ad_count, DATE_FORMAT(ad_publish_date, '%Y') AS date_formated"))->groupBy('date_formated')->orderBy('date_formated', 'desc')->take(10)->get()->toArray();
     $stat->ads_by_year = [];
     if (!empty($ads_by_year)) {
         $stat->ads_by_year = array_reverse($ads_by_year);
     }
     return view('admin.dashboard.dashboard', ['stat' => $stat]);
 }
 public function challenges()
 {
     $startd = DB::table('Games')->select('start')->first();
     $endd = DB::table('Games')->select('stop')->first();
     if ($startd->start > Carbon::now()) {
         return view("pages.countdown");
     } elseif ($endd->stop < Carbon::now()) {
         return view('pages.closed');
     }
     $num_users = User::count();
     $completed = Submitted_flag::count();
     $num_challenges = Challenge::count();
     $average_c = $completed / $num_users / $num_challenges * 100;
     $stats = array('num_users' => $num_users, 'completed' => $completed, 'average' => $average_c);
     $mycompleted = Submitted_flag::where('user_id', Auth::user()->id)->get()->toArray();
     $game = Game::first();
     $categories = Category::get();
     $categories = $categories->toArray();
     foreach ($categories as $category) {
         $challenges = Challenge::where('category_id', $category['id'])->orderby('point_value', 'ASC')->get()->toArray();
         $categories[(int) $category['id'] - 1]['challenges'] = $challenges;
     }
     $directory = base_path() . '/public/Challenges_Repo/';
     $files = scandir($directory);
     $startd = DB::table('Games')->select('start')->first();
     if ($startd->start > Carbon::now()) {
         $start = true;
     } else {
         $start = false;
     }
     $data = array('user' => Auth::user(), 'game' => $game, 'categories' => $categories, 'stats' => $stats, 'files' => $files, 'completed' => $mycompleted, 'start' => $start);
     return view("pages.challenges")->with('data', $data);
 }
Example #11
0
 public function testGet()
 {
     $users = User::get();
     $this->assertEquals(3, $users->count());
     $users = User::where('id', '>', 1)->get();
     $this->assertEquals(2, $users->count());
     // test chunk
     User::chunk(2, function ($users) {
         foreach ($users as $user) {
             $this->assertInternalType('int', $user->id);
         }
     });
     User::chunk(1, function ($users) {
         $this->assertInstanceOf('Illuminate\\Support\\Collection', $users);
     });
     // test find with query builder
     $user = User::where('id', '>', 1)->find(1);
     $this->assertNull($user);
     $user = User::where('id', '>', 1)->find(2);
     $this->assertEquals(2, $user->id);
     // test first without query builder
     $user = User::first();
     $this->assertInstanceOf('App\\User', $user);
     // test retrieving aggregates
     $max_id = User::max('id');
     $this->assertGreaterThanOrEqual(3, $max_id);
     $count = User::count();
     $this->assertGreaterThanOrEqual(3, $count);
     $sum = User::sum('id');
     $this->assertGreaterThanOrEqual(6, $sum);
 }
Example #12
0
 public static function tableRowCount($col, $met, $val)
 {
     if (strlen(trim($val)) > 0) {
         return User::where(DB::raw($col), $met, '%' . str_replace(' ', '%', $val) . '%')->count();
     } else {
         return User::count();
     }
 }
 public function index()
 {
     $title = "Dashboard";
     $questions = Question::count();
     $questioncategories = QuestionCategory::count();
     $users = User::count();
     return view('admin.dashboard.index', compact('title', 'questions', 'questioncategories', 'countries', 'users'));
 }
Example #14
0
 public function index()
 {
     $article_num = Article::count();
     $articles = Article::sortByDesc('id')->take(5)->get();
     $user_num = User::count();
     $users = User::sortByDesc('id')->take(5)->get();
     return Theme::view('admin.dash.index', compact(['article_num', 'user_num', 'articles', 'users']));
 }
Example #15
0
 public function index()
 {
     $userCount = User::count();
     $articleCount = Article::count();
     $tagCount = Tag::count();
     $imageCount = Image::count();
     return view('admin.index', compact('userCount', 'articleCount', 'imageCount', 'tagCount'));
 }
 public function delete($id)
 {
     if (User::count() < 2) {
         return redirect('admin/users');
     }
     User::findOrFail($id)->delete();
     return redirect('/admin/users');
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $users = User::all();
     $totalUser = User::count();
     //  dd($totalBiz);
     //  foreach( $bizs as $biz)
     return view('admin.user.index', compact('users', 'totalUser'));
 }
 public function home()
 {
     $stats['employees'] = \App\Employee::count();
     $stats['assets'] = \App\Asset::count();
     $stats['users'] = \App\User::count();
     $stats['vendors'] = \App\Vendor::count();
     return View('pages.dashboard', compact('stats'));
 }
 public function index()
 {
     $title = "Dashboard";
     $users = User::count();
     $notifications = Notification::count();
     $packages = Package::count();
     return view('admin.dashboard.index', compact('users', 'title', 'notifications', 'packages'));
 }
 public function index()
 {
     $article_count = Article::count();
     $category_count = Category::count();
     $tag_count = Tag::count();
     $user_count = User::count();
     return view('admin.console', compact('article_count', 'category_count', 'tag_count', 'user_count'));
 }
Example #21
0
 public function run()
 {
     $faker = Faker::create();
     //Category
     for ($i = 0; $i < 10; $i++) {
         $user = User::select(['id'])->where('id', rand(1, User::count()))->first();
         $address = Address::create(['user_id' => $i <= 2 ? 4 : $user->id, 'default' => 0, 'line1' => $faker->streetAddress, 'line2' => $faker->streetAddress, 'phone' => $faker->e164PhoneNumber, 'name_contact' => $faker->streetName, 'zipcode' => $faker->postcode, 'city' => $faker->city, 'country' => $faker->country, 'state' => $faker->state]);
     }
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $this->info('Welcome to 2015 Election API');
     if (User::count() > 0) {
         $this->error('Application is already installed!');
         exit;
     }
     $this->createUser();
 }
Example #23
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     //App::setLocale('kh');
     //return trans('administrators.dashboard');
     //$user = Auth::user();
     //return $user->toJson();
     return View('admin.dashboard')->with(['user_total' => \App\User::count(), 'content_total' => \App\Content::count(), 'category_total' => \App\Category::count(), 'slider_total' => \App\Slider::count()]);
 }
Example #24
0
 public function index()
 {
     $article_num = Article::count();
     $user_num = User::count();
     $person_num = Person::count();
     $project_num = Project::count();
     $users = User::sortByDesc('id')->take(5)->get();
     return Theme::view('admin.dash.index', compact('article_num', 'user_num', 'person_num', 'project_num', 'users'));
 }
Example #25
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     if (User::count() == 0) {
         $user_rank = 'admin';
     } else {
         $user_rank = 'user';
     }
     return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password']), 'rank' => $user_rank]);
 }
Example #26
0
 public function dashboard()
 {
     // $this->middleware('auth');
     $researchs = Research::count();
     $funds = Fund::count();
     $translations = Translation::count();
     $users = User::count();
     return view('dashboard', ['researchs' => $researchs, 'funds' => $funds, 'translations' => $translations, 'users' => $users]);
 }
Example #27
0
 public function getSiteStat()
 {
     return Cache::remember(self::CACHE_KEY, self::CACHE_MINUTES, function () {
         $entity = new StatEntity();
         $entity->topic_count = Topic::count();
         $entity->reply_count = Reply::count();
         $entity->user_count = User::count();
         return $entity;
     });
 }
 public function adminDashboard()
 {
     $page = 'partials.admin-dashboard';
     $users = User::all();
     $user_count = User::count();
     $product_count = Product::count();
     $brand_count = Brand::count();
     $type_count = Type::count();
     return view('quantri/admin', compact('page', 'users', 'user_count', 'product_count', 'brand_count', 'type_count'));
 }
Example #29
0
 public function index()
 {
     $pages = \App\Page::count();
     $banners = \App\Banner::count();
     $coupons = \App\Coupons::count();
     $posts = \App\Post::count();
     $users = \App\User::count();
     $images = \App\Image::count();
     return view('home')->with('pages', $pages)->with('banners', $banners)->with('coupons', $coupons)->with('posts', $posts)->with('users', $users)->with('images', $images);
 }
 public function index()
 {
     $title = "Dashboard";
     $article = Article::count();
     $articlecategory = ArticleCategory::count();
     $users = User::count();
     $photo = Photo::count();
     $photoalbum = PhotoAlbum::count();
     return view('admin.dashboard.index', compact('title', 'article', 'articlecategory', 'photo', 'photoalbum', 'users'));
 }