diff --git a/app/Http/Middleware/RefreshUserJwt.php b/app/Http/Middleware/RefreshUserJwt.php index 8da463a..64ad9a5 100644 --- a/app/Http/Middleware/RefreshUserJwt.php +++ b/app/Http/Middleware/RefreshUserJwt.php @@ -9,10 +9,17 @@ use Symfony\Component\HttpFoundation\Response; class RefreshUserJwt { - public function handle(Request $request, Closure $next, JwtService $jwtService): Response + protected JwtService $jwtService; + + public function __construct(JwtService $jwtService) + { + $this->jwtService = $jwtService; + } + + public function handle(Request $request, Closure $next): Response { if ($request->user()) { - $jwtService->refreshIfNeeded($request->user()); + $this->jwtService->refreshIfNeeded($request->user()); } return $next($request);