remove user

This commit is contained in:
2019-02-03 00:39:18 -06:00
parent fe20a14364
commit de5aad1eb0
4 changed files with 9 additions and 108 deletions

View File

@@ -75,40 +75,17 @@ class AdminController extends Controller
//Get the user data from the table
$data = User::where(['name' => $user])->get();
try {
//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 Scopes
DB::table('EsiScopes')->where(['character_id' => $data->character_id])->delete();
try {
//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 ESI Token
DB::table('EsiTokens')->where(['character_id' => $data->character_id])->delete();
try {
//Delete the user from the user table
User::where(['character_id' => $data->character_id])->delete();
} catch(Exception $e) {
//Don't do anything. Just continue on.
}
//Delete the user's role from the roles table
DB::table('user_roles')->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.
}
//Delete the user from the user table
DB::table('users')->where(['character_id' => $data->character_id])->delete();
return redirect('/admin/dashboard')->with('success', 'User deleted from the site.');
}

View File

@@ -1,27 +0,0 @@
@extends('layouts.b4')
@section('content')
<div class="container">
<h2>Fleets</h2>
@if(isset($error))
<?php var_dump($error); ?>
@endif
@if(isset($data))
@for($i = 0; $i < count($data[0]); $i++)
<a href="{{ route('addpilot', [$data[1][$i], Auth::user()->character_id]) }}">Join {{ $data[2][$i] }}</a><br>
@if(Auth::user()->character_id == $data[0][$i])
<a href="{{ route('deletefleet', [$data[1][$i]]) }}">Delete Fleet</a><br><br>
@endif
<!-- Create form for inserting a user by name -->
@if(Auth::user()->character_id == $data[0][$i])
{!! Form::open(['action' => '/fleets/{fleet_id}/addpilot/{name}', 'method' => 'GET']) !!}
<div class="form-group col-md-4">
{{ Form::label('pilot', 'Pilot') }}
{{ Form::text('pilot', '', ['class' => 'form-control']) }}
</div>
{{ Form::submit('Submit', ['class' => 'btn btn-primary']) }}
{!! Form::close() !!}
@endif
@endfor
@endif
</div>
@endsection

View File

@@ -1,15 +0,0 @@
@extends('layouts.b4')
@section('content')
<div class="container">
<h2>Register A New Fleet</h2>
{!! Form::open(['action' => 'FleetsController@registerFleet', 'method' => 'POST']) !!}
<div class="form-group col-md-6">
{{ Form::label('fleetUri', 'Fleet') }}
{{ Form::text('fleetUri', '', ['class' => 'form-control', 'placeholder' => 'Fleet URL']) }}
{{ Form::label('description', 'Fleet Name') }}
{{ Form::text('description', '', ['class' => 'form control', 'placeholder' => 'Fleet Name']) }}
</div>
{{ Form::submit('Submit', ['class' => 'btn btn-primary']) }}
{!! Form::close() !!}
</div>
@endsection

View File

@@ -2,8 +2,6 @@
@section('content')
<?php
$publicData = false;
$writeFleet = false;
$readFleet = false;
$readLocation = false;
$writeMail = false;
$readMail = false;
@@ -25,27 +23,7 @@
<?php $publicData = true; ?>
@break
@endif
@endforeach
@foreach($scopes as $scope)
@if($scope->scope == 'esi-fleets.write_fleet.v1')
<div class="form-group col-md-6">
{{ Form::label('scopes[]', 'Write Fleet') }}
{{ Form::checkbox('scopes[]', 'esi-fleets.write_fleet.v1', 'true') }}
</div>
<?php $writeFleet = true; ?>
@break
@endif
@endforeach
@foreach($scopes as $scope)
@if($scope->scope == 'esi-fleets.read_fleet.v1')
<div class="form-group col-md-6">
{{ Form::label('scopes[]', 'Read Fleet') }}
{{ Form::checkbox('scopes[]', 'esi-fleets.read_fleet.v1', 'true') }}
</div>
<?php $readFleet = true; ?>
@break
@endif
@endforeach
@endforeach
@foreach($scopes as $scope)
@if($scope->scope == 'esi-location.read_location.v1')
<div class="form-group col-md-6">
@@ -131,18 +109,6 @@
{{ Form::checkbox('scopes[]', 'publicData') }}
</div>
@endif
@if($writeFleet == false)
<div class="form-group col-md-6">
{{ Form::label('scopes[]', 'Write Fleet') }}
{{ Form::checkbox('scopes[]', 'esi-fleets.write_fleet.v1') }}
</div>
@endif
@if($readFleet == false)
<div class="form-group col-md-6">
{{ Form::label('scopes[]', 'Read Fleet') }}
{{ Form::checkbox('scopes[]', 'esi-fleets.read_fleet.v1') }}
</div>
@endif
@if($readLocation == false)
<div class="form-group col-md-6">
{{ Form::label('scopes[]', 'Read Location') }}