From 4cf5c9671e733f309c616105cbae1925f1151c4a Mon Sep 17 00:00:00 2001 From: Al-Amin Firdows Date: Mon, 30 May 2022 11:25:55 +0600 Subject: [PATCH] feat: replace env method call by config (Resolve #11) --- app/Http/Controllers/UserController.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 4f0a1c0..bff84bf 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -45,10 +45,9 @@ class UserController extends Controller { 'name' => $creds['name'] ]); - $default_user_role_id = env('DEFAULT_ROLE_ID', 2); UserRole::create([ 'user_id' => $user->id, - 'role_id' => $default_user_role_id + 'role_id' => config('hydra.default_user_role_id', 2) ]); @@ -72,7 +71,7 @@ class UserController extends Controller { return response(['error' => 1, 'message' => 'invalid credentials'], 401); } - if (env('DELETE_PREVIOUS_ACCESS_TOKENS_ON_LOGIN', false) == true) { + if (config('hydra.delete_previous_access_tokens_on_login', false)) { $user->tokens()->delete(); }