Initial commit - Physiotherapy Clinic Management System
This commit is contained in:
commit
dbb326f2cc
300 files changed
+144285
No files matched your search
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Patient;
|
||||
use App\Models\Appointment;
|
||||
use App\Models\Invoice;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$today = Carbon::today();
|
||||
|
||||
$stats = [
|
||||
'total_patients' => Patient::count(),
|
||||
'today_appointments' => Appointment::whereDate('appointment_date', $today)->count(),
|
||||
'pending_invoices' => Invoice::where('status', 'sent')->orWhere('status', 'partial')->count(),
|
||||
'month_revenue' => Invoice::whereMonth('invoice_date', $today->month)
|
||||
->whereYear('invoice_date', $today->year)
|
||||
->sum('paid_amount'),
|
||||
];
|
||||
|
||||
$recent_appointments = Appointment::with('patient', 'user')
|
||||
->whereDate('appointment_date', '>=', $today)
|
||||
->orderBy('appointment_date')
|
||||
->limit(5)
|
||||
->get();
|
||||
|
||||
return view('dashboard', compact('stats', 'recent_appointments'));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user