From d2484c233caa95c54bdf18e547a87ad3e9d5f04d Mon Sep 17 00:00:00 2001 From: Mohammad Hafijul Islam Date: Sat, 30 Mar 2024 13:59:58 +0600 Subject: [PATCH] missing request user method call added --- src/Http/Middlewares/LastLoggedIn.php | 5 ++--- src/Http/Middlewares/LastLoggedOut.php | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Http/Middlewares/LastLoggedIn.php b/src/Http/Middlewares/LastLoggedIn.php index 667dee5..09213ff 100644 --- a/src/Http/Middlewares/LastLoggedIn.php +++ b/src/Http/Middlewares/LastLoggedIn.php @@ -3,8 +3,7 @@ namespace Fintech\Auth\Http\Middlewares; use Illuminate\Http\Request; -use Illuminate\Support\Facades\Auth; -use Symfony\Component\HttpFoundation\Response; + class LastLoggedIn { @@ -27,7 +26,7 @@ public function handle(Request $request, \Closure $next) */ public function terminate(Request $request, $response): void { - $user = Auth::user(); + $user = $request->user('sanctum'); \Fintech\Auth\Facades\Auth::user()->updateRaw($user->getKey(), ['logged_in_at' => now()]); } diff --git a/src/Http/Middlewares/LastLoggedOut.php b/src/Http/Middlewares/LastLoggedOut.php index fc6c8a0..65c319c 100644 --- a/src/Http/Middlewares/LastLoggedOut.php +++ b/src/Http/Middlewares/LastLoggedOut.php @@ -4,7 +4,6 @@ use Closure; use Illuminate\Http\Request; -use Illuminate\Support\Facades\Auth; class LastLoggedOut { @@ -15,7 +14,7 @@ class LastLoggedOut */ public function handle(Request $request, Closure $next) { - $user = Auth::user(); + $user = $request->user('sanctum'); \Fintech\Auth\Facades\Auth::user()->updateRaw($user->getKey(), ['logged_out_at' => now()]);