| Server IP : 14.225.204.176 / Your IP : 216.73.216.6 Web Server : nginx/1.24.0 System : Linux nodejs-ybgk 6.8.0-40-generic #40-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 5 10:34:03 UTC 2024 x86_64 User : root ( 0) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/php/home-services/app/Http/Controllers/ |
Upload File : |
<?php
/*
* File name: DashboardController.php
* Last modified: 2021.12.04 at 12:22:28
* Author: SmarterVision - https://codecanyon.net/user/smartervision
* Copyright (c) 2022
*/
namespace App\Http\Controllers;
use App\Repositories\BookingRepository;
use App\Repositories\EarningRepository;
use App\Repositories\EProviderRepository;
use App\Repositories\UserRepository;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\Response;
use Illuminate\View\View;
class DashboardController extends Controller
{
/** @var BookingRepository */
private $bookingRepository;
/**
* @var UserRepository
*/
private $userRepository;
/** @var EProviderRepository */
private $eProviderRepository;
/** @var EarningRepository */
private $earningRepository;
public function __construct(BookingRepository $bookingRepo, UserRepository $userRepo, EarningRepository $earningRepository, EProviderRepository $eProviderRepo)
{
parent::__construct();
$this->bookingRepository = $bookingRepo;
$this->userRepository = $userRepo;
$this->eProviderRepository = $eProviderRepo;
$this->earningRepository = $earningRepository;
}
/**
* Display a listing of the resource.
*
* @return Application|Factory|Response|View
*/
public function index()
{
$bookingsCount = $this->bookingRepository->count();
$membersCount = $this->userRepository->count();
$eprovidersCount = $this->eProviderRepository->count();
$eProviders = $this->eProviderRepository->orderBy('id', 'desc')->limit(4);
$earning = $this->earningRepository->all()->sum('total_earning');
$ajaxEarningUrl = route('payments.byMonth', ['api_token' => auth()->user()->api_token]);
return view('dashboard.index')
->with("ajaxEarningUrl", $ajaxEarningUrl)
->with("bookingsCount", $bookingsCount)
->with("eProvidersCount", $eprovidersCount)
->with("eProviders", $eProviders)
->with("membersCount", $membersCount)
->with("earning", $earning);
}
}