diff --git a/app/Controllers/Api/AuthController.php b/app/Controllers/Api/AuthController.php index 1a4bdef..7bc4660 100644 --- a/app/Controllers/Api/AuthController.php +++ b/app/Controllers/Api/AuthController.php @@ -30,7 +30,6 @@ public function login(AuthRequest $request, JsonResponse $json): JsonResponse 'iat' => $time, 'exp' => $time + (60 * 60), 'iss' => base_url(), - 'is_admin' => true, ...Auth::user()->only(['id', 'name', 'email'])->toArray() ], env('JWT_KEY'), diff --git a/app/Middleware/AuthMiddleware.php b/app/Middleware/AuthMiddleware.php index f48086b..4e1108c 100644 --- a/app/Middleware/AuthMiddleware.php +++ b/app/Middleware/AuthMiddleware.php @@ -29,6 +29,8 @@ public function handle(Request $request, Closure $next) new Key(env('JWT_KEY'), env('JWT_ALGO', 'HS256')) )); + $user->is_admin = true; + Auth::login($user); } catch (Exception $e) { return (new JsonResponse)->errorBadRequest([$e->getMessage()]);