From ebe0a24d803c30ae1de0073e5dd88de8176ea8ac Mon Sep 17 00:00:00 2001 From: drkthunder02 Date: Wed, 26 Dec 2018 02:22:27 -0600 Subject: [PATCH] updated AuthServiceProvider to utilize Eloquent more fluently. --- app/Providers/AuthServiceProvider.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index ebf1822d5..cb1c871a1 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -33,7 +33,7 @@ class AuthServiceProvider extends ServiceProvider $gate->define('isAdmin', function($user) { //Get the roles the user has from the user_roles table and check against the gate we are creating - $check = DB::table('user_roles')->where('character_id', auth()->user()->character_id)->get(['role']); + $check = UserRole::where('character_id', auth()->user()->character_id)->get(['role']); if($check[0]->role === 'Admin') { //User has the Admin role return true; @@ -44,7 +44,7 @@ class AuthServiceProvider extends ServiceProvider $gate->define('isDirector', function($user) { //Get the roles the user has from the user_roles table and check against the gate we are creating - $check = DB::table('user_roles')->where('character_id', auth()->user()->character_id)->get(['role']); + $check = UserRole::where('character_id', auth()->user()->character_id)->get(['role']); if($check[0]->role === 'Director') { //User has the Director role return true; @@ -55,7 +55,7 @@ class AuthServiceProvider extends ServiceProvider $gate->define('isUser', function($user) { //Get the roles the user has from the user_roles table and check against the gate we are creating - $check = DB::table('user_roles')->where('character_id', auth()->user()->character_id)->get(['role']); + $check = UserRole::where('character_id', auth()->user()->character_id)->get(['role']); if($check[0]->role === 'User') { //User has the User role return true; @@ -66,7 +66,7 @@ class AuthServiceProvider extends ServiceProvider $gate->define('isGuest', function($user) { //Get the roles the user has from the user_roles table and check against the gate we are creating - $check = DB::table('user_roles')->where('character_id', auth()->user()->character_id)->get(['role']); + $check = UserRole::where('character_id', auth()->user()->character_id)->get(['role']); if($check[0]->role === 'Guest') { //User has the Guest role return true; @@ -77,7 +77,7 @@ class AuthServiceProvider extends ServiceProvider $gate->define('isNone', function($user) { //Get the roles the user has from the user_roles table and check against the gate we are creating - $check = DB::table('user_roles')->where('character_id', auth()->user()->character_id)->get(['role']); + $check = UserRole::where('character_id', auth()->user()->character_id)->get(['role']); if($check[0]->role === 'None') { //User has no role return true;