@php $notifications = \App\Models\Notification::getNotifications(Auth::id(), \App\Helpers\ApiHelper::getAuthRole(), 50, Auth::user()?->zone(), \App\Helpers\ApiHelper::getAuthState(), \App\Helpers\ApiHelper::getAuthUserDepartment())->sortByDesc('created_at'); $completedIndentIds = $notifications->whereNotNull('completed_on')->pluck('module_id')->unique(); $pendingNotifications = $notifications ->whereNull('completed_on') ->whereNotIn('module_id', $completedIndentIds) ->take(3); $completedNotifications = $notifications ->whereNotNull('completed_on') ->take(3); $notificationCount = $pendingNotifications->count(); $favorites = \App\Models\Favorite::getFavorites(Auth::user()->id); $attendance = App\Helpers\AppHelper::Attendance(); $inDate = $attendance['in_date'] ?? null; $outDate = $attendance['out_date'] ?? null; $outTime = $attendance['out_time'] ?? null; $inTime = $attendance['in_time'] ?? null; $inStatus = $attendance['in_status'] ?? null; $outStatus = $attendance['out_status'] ?? null; $user = Auth::user(); $employee = $user->employee; $leaveStats = [ 'cl' => 0, 'sl' => 0, 'el' => 0, 'lop' => 0, 'loptbd' => 0, ]; $pendings = collect(); if ($employee) { $leaveStats = Cache::remember("leave_stats_{$user->id}", now()->addHour(), fn() => EmployeeHelper::leaveStats($employee)); $pendings = Cache::remember("pending_leave_stats_{$user->id}", now()->addHour(), fn() => EmployeeHelper::pendingleaveStats($employee)); } $weekday =$attendance['weekday'] ?? null; @endphp