check()) { // 未登入,記錄日誌並重導向 \Log::warning('Unauthorized access attempt.', ['url' => $request->url()]); return redirect()->route('login'); } // 驗證成功,繼續處理請求 return $next($request); } }