user()->roles()->first()->name; $key = sprintf('user_role:%d', auth()->id()); $role = Cache::remember($key, now()->addMinutes(5), fn (): string => auth()->user()->roles()->first()->name); return match (Role::from($role)) { Role::Admin => new AdminWorklist, Role::Technician => new TechnicianWorklist, Role::Radiologist => new RadiologistWorklist, Role::Clinician => new ClinicianWorklist, default => throw new Exception("Unknown user role: {$role}"), }; } }