From 85e23ac2d085b92051cacd6d29fd7b2e90fca853 Mon Sep 17 00:00:00 2001 From: Hritikkk9 Date: Tue, 16 Jul 2024 18:58:17 +0530 Subject: [PATCH] restaurant and customer updated --- app/Http/Middleware/CustomerJwtMiddleware.php | 3 +++ app/Http/Middleware/RestaurantJwtMiddleware.php | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/Http/Middleware/CustomerJwtMiddleware.php b/app/Http/Middleware/CustomerJwtMiddleware.php index b537196..f4d4bf7 100644 --- a/app/Http/Middleware/CustomerJwtMiddleware.php +++ b/app/Http/Middleware/CustomerJwtMiddleware.php @@ -42,6 +42,9 @@ class CustomerJwtMiddleware } Log::info("Customer jwt"); Log::info($user); + Log::info($user->principal_type_xid); + + Session::flash('vendorToken', $token); diff --git a/app/Http/Middleware/RestaurantJwtMiddleware.php b/app/Http/Middleware/RestaurantJwtMiddleware.php index 3c0ed74..166bcc4 100644 --- a/app/Http/Middleware/RestaurantJwtMiddleware.php +++ b/app/Http/Middleware/RestaurantJwtMiddleware.php @@ -8,7 +8,7 @@ use Illuminate\Support\Facades\Session; use Symfony\Component\HttpFoundation\Response; use Tymon\JWTAuth\Exceptions\JWTException; use Tymon\JWTAuth\Facades\JWTAuth; - +use Illuminate\Support\Facades\Log; class RestaurantJwtMiddleware { /** @@ -35,9 +35,16 @@ class RestaurantJwtMiddleware $user = JWTAuth::setToken($token)->authenticate(); // Check if the user is of restaurant type - if (!$user ||$user->principal_type_xid !== 4) { + Log::info("Restaurant Jwt"); + + Log::info($user); + + if (!$user ||$user->principal_type_xid != 4) { return response()->json(['status' => 'error', 'status_code' => 401, 'message' => 'Unauthorized access'], 401); } + Log::info("Restaurant Jwt"); + + Log::info($user->principal_type_xid); Session::flash('RestToken', $token); } catch (JWTException $e) {