admincontroller

This commit is contained in:
2018-12-30 02:15:50 -06:00
parent 06ad07f719
commit a916a7b29c

View File

@@ -50,7 +50,8 @@ class AdminController extends Controller
//Get the character id from the username using the user table //Get the character id from the username using the user table
$character = User::where(['name' => $user])->get(); $character = User::where(['name' => $user])->get();
//Check to see if the character already has the permission //Check to see if the character already has the permission
if(!UserPermission::where(['character_id' => $character->character_id, 'permission' => $permission])->exists()) { $check = DB::table('user_permissions')->where(['character_id' => $character->character_id, 'permission' => $permission])->get();
if(!isset($check[0])) {
$perm = new UserPermission; $perm = new UserPermission;
$perm->character_id = $character->character_id; $perm->character_id = $character->character_id;
$perm->permission = $permission; $perm->permission = $permission;
@@ -60,7 +61,6 @@ class AdminController extends Controller
} else { } else {
return redirect('/admin/dashboard')->with('error', 'User not updated or already has the permission.'); return redirect('/admin/dashboard')->with('error', 'User not updated or already has the permission.');
} }
} }
public function removePermission(Request $request) { public function removePermission(Request $request) {