35 lines
1.0 KiB
PHP
35 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\patient;
|
|
use App\Models\roomService;
|
|
use App\Models\transaksi;
|
|
use Carbon\Carbon;
|
|
use Illuminate\Http\Request;
|
|
use Spatie\FlareClient\View;
|
|
|
|
class dashboardController extends Controller
|
|
{
|
|
public function index(){
|
|
$now = Carbon::now();
|
|
$pasien = patient::where('is_delete', false)->count();
|
|
$totalRuangan_pelayanan = roomService::where('is_delete', false)->count();
|
|
$data = transaksi::selectRaw('COUNT(*) as total_transaksi, SUM(price) as total_harga')
|
|
->whereDate('created_at', $now)->where('is_delete', false)
|
|
->first();
|
|
|
|
$jumlahTransaksiHariIni = $data->total_transaksi;
|
|
$totalHargaTransaksiHariIni = $data->total_harga;
|
|
|
|
$data = [
|
|
'title' => 'Dashboard',
|
|
'total_pasien' => $pasien,
|
|
'total_rp' => $totalRuangan_pelayanan,
|
|
'trx_today' => $jumlahTransaksiHariIni,
|
|
'trx_nominal' => $totalHargaTransaksiHariIni,
|
|
];
|
|
return view('dashboard.index', $data);
|
|
}
|
|
}
|