Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
WIKIPEDIA
/
amparoapi
/
app
/
Http
/
Controllers
:
DashboardController.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php namespace App\Http\Controllers; use App\Models\Company; use App\Models\CustomerAccount; use App\Models\CustomerCard; use App\Models\Recharge; use Illuminate\Http\Request; class DashboardController extends Controller { public function getGeneralDashboard() { $totalCards = CustomerCard::query()->count(); $totalAccounts = CustomerAccount::query()->count(); $totalCompanies = Company::query()->count(); $totalRecharges = Recharge::query()->count(); $totalAccountBalance = CustomerAccount::query()->sum('balance'); $cActivos = CustomerCard::query()->where('status', '=', 'activo')->count(); $cNeverUsed = CustomerCard::query()->where('session_status', '=', 0)->count(); $canRechargeCards = CustomerCard::query()->where('can_recharge', '=', 0)->count(); $canReceiveNotificationCards = CustomerCard::query()->where('can_receive_notification', '=', 1)->count(); $canPayCards = CustomerCard::query()->where('can_pay', '=', 1)->count(); return response()->json([ 'totalCards' => $totalCards, 'activeCards' => $cActivos, 'neverUsedCards' => $cNeverUsed, 'canRechargeCards' => $canRechargeCards, 'canPayCards' => $canPayCards, 'canReceiveNotificationCards' => $canReceiveNotificationCards, 'totalAccounts' => $totalAccounts, 'totalCompanies' => $totalCompanies, 'totalAccountBalance' => $totalAccountBalance, 'totalRecharges' => $totalAccountBalance, ]); } }