count(); $operationalLv = Vehicle::lightVehicles()->where('status', 'Operation')->count(); $standbyLv = Vehicle::lightVehicles()->where('status', 'Standby')->count(); $totalDrivers = Employee::operators()->count(); $validSimperCount = Employee::operators() ->whereNotNull('simper_expired_at') ->where('simper_expired_at', '>=', Carbon::today()) ->count(); $expiredSimperCount = max(0, $totalDrivers - $validSimperCount); $totalGates = Gate::where('is_active', true)->count(); $todayActivitiesCount = VehicleActivity::whereDate('recorded_at', Carbon::today())->count(); $totalActivities = VehicleActivity::count(); // 2. Daftar Seluruh Pos Gerbang Proyek $gates = Gate::where('is_active', true) ->orderBy('name') ->get(); return view('home', compact( 'totalLv', 'operationalLv', 'standbyLv', 'totalDrivers', 'validSimperCount', 'expiredSimperCount', 'totalGates', 'todayActivitiesCount', 'totalActivities', 'gates' )); } }