isAdmin()) { abort(403, 'Unauthorized'); } // Notify admin email of access — throttled to once per 15 minutes per user+IP $adminEmail = config('app.admin_notify_email'); if ($adminEmail) { $cacheKey = 'admin_notify:' . Auth::id() . ':' . $request->ip(); if (!Cache::has($cacheKey)) { Notification::route('mail', $adminEmail)->notify( new AdminAccessNotification( Auth::user()->name, $request->ip(), $request->header('User-Agent', 'unknown') ) ); Cache::put($cacheKey, true, now()->addMinutes(15)); } } return $next($request); } }