admin controller

This commit is contained in:
2019-02-03 00:29:03 -06:00
parent dbd0af5adb
commit fe20a14364

View File

@@ -75,21 +75,40 @@ class AdminController extends Controller
//Get the user data from the table //Get the user data from the table
$data = User::where(['name' => $user])->get(); $data = User::where(['name' => $user])->get();
//Delete the user's ESI Scopes try {
EsiScope::where(['character_id' => $data->character_id])->delete(); //Delete the user's ESI Scopes
EsiScope::where(['character_id' => $data->character_id])->delete();
} catch(Exception $e) {
//Don't do anything. Just continue on.
}
try {
//Delete the user's ESI Token
EsiToken::where(['character_id' => $data->character_id])->delete();
} catch(Exception $e) {
//Don't do anything. Just continue on.
}
//Delete the user's ESI Token try {
EsiToken::where(['character_id' => $data->character_id])->delete(); //Delete the user's roles from the roles table
UserRole::where(['character_id' => $data->character_id])->delete();
} catch(Exception $e) {
//Don't do anything. Just continue on.
}
//Delete the user's roles from the roles table try {
UserRole::where(['character_id' => $data->character_id])->delete(); //Delete the user from the user table
User::where(['character_id' => $data->character_id])->delete();
//Delete the user from the user table } catch(Exception $e) {
User::where(['character_id' => $data->character_id])->delete(); //Don't do anything. Just continue on.
}
//Delete the user's structures
CorpStructure::where(['character_id' => $data->character_id])->delete();
try {
//Delete the user's structures
CorpStructure::where(['character_id' => $data->character_id])->delete();
} catch(Exception $e) {
//Don't do anything. Just continue on.
}
return redirect('/admin/dashboard')->with('success', 'User deleted from the site.'); return redirect('/admin/dashboard')->with('success', 'User deleted from the site.');
} }