restaurant and customer updated

This commit is contained in:
Hritikkk9
2024-07-16 18:58:17 +05:30
parent c526fcbdad
commit 85e23ac2d0
2 changed files with 12 additions and 2 deletions

View File

@@ -42,6 +42,9 @@ class CustomerJwtMiddleware
}
Log::info("Customer jwt");
Log::info($user);
Log::info($user->principal_type_xid);
Session::flash('vendorToken', $token);

View File

@@ -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) {