updated default reason for blacklist.

This commit is contained in:
2019-12-04 20:36:30 -06:00
4 changed files with 56 additions and 32 deletions

View File

@@ -57,23 +57,28 @@ class BlacklistController extends Controller
if($count === 0) {
//Get the character id from the universe end point
$charId = $lookup->CharacterNameToId($request->name);
//Insert the character into the blacklist table
BlacklistUser::insert([
'character_id' => $charId,
'name' => $request->name,
'reason' => $request->reason,
'alts' => $request->alts,
'lister_id' => auth()->user()->getId(),
'lister_name' => auth()->user()->getName(),
]);
if($charId != null) {
//Insert the character into the blacklist table
BlacklistUser::insert([
'character_id' => $charId,
'name' => $request->name,
'reason' => $request->reason,
'alts' => $request->alts,
'lister_id' => auth()->user()->getId(),
'lister_name' => auth()->user()->getName(),
]);
} else {
//Redirect back to the view
return redirect('/blacklist/display/add')->with('error', $request->name . ' could not be added.');
}
} else {
//Return the view
return view('blacklist.add')->with('error', 'Character is already on the black list.');
}
//Return the view
return redirect('/blacklist/display')->with('success', 'Character added to the blacklist');
return redirect('/blacklist/display/add')->with('success', $request->name . ' added to the blacklist.');
}
public function RemoveFromBlacklist(Request $request) {
@@ -118,9 +123,7 @@ class BlacklistController extends Controller
//If the count for the blacklist is greater than 0, then get the details, and send it to the view
if($blacklistCount > 0) {
//Try to find the user in the blacklist
$blacklist = BlacklistUser::where([
'name' => $request->name,
])->first();
$blacklist = BlacklistUser::where(['name', 'like', $request->name])->get();
//Send the data to the view
return view('blacklist.list')->with('blacklist', $blacklist)

View File

@@ -92,7 +92,7 @@ class NewLookupHelper {
return $response->characters[0]->id;
} else {
return -1;
return null;
}
}
}
@@ -147,7 +147,7 @@ class NewLookupHelper {
return $response->corporations[0]->id;
} else {
return -1;
return null;
}
}
}
@@ -200,7 +200,7 @@ class NewLookupHelper {
return $response->alliances[0]->id;
} else {
return -1;
return null;
}
}
}
@@ -359,7 +359,10 @@ class NewLookupHelper {
}
private function SaveCharacter($response, $charId) {
$esiHelper = new Esi;
$char = new CharacterLookup;
$char->character_id = $charId;
if(isset($response->alliance_id)) {
$char->alliance_id = $response->alliance_id;
@@ -367,7 +370,7 @@ class NewLookupHelper {
if(isset($response->ancestry_id)) {
$char->ancestry_id = $response->ancestry_id;
}
$char->birthday = $response->birthday;
$char->birthday = $esiHelper->DecodeDate($response->birthday);
$char->bloodline_id = $response->bloodline_id;
$char->corporation_id = $response->corporation_id;
if(isset($response->description)) {
@@ -518,6 +521,8 @@ class NewLookupHelper {
}
private function SaveCorporation($response, $corpId) {
$esiHelper = new Esi;
$corp = new CorporationLookup;
$corp->corporation_id = $corpId;
if(isset($response->alliance_id)) {
@@ -526,7 +531,7 @@ class NewLookupHelper {
$corp->ceo_id = $response->ceo_id;
$corp->creator_id = $response->creator_id;
if(isset($response->date_founded)) {
$corp->date_founded = $response->date_founded;
$corp->date_founded = $esiHelper->DecodeDate($response->date_founded);
}
if(isset($response->description)) {
$corp->description = $response->description;
@@ -706,11 +711,13 @@ class NewLookupHelper {
}
private function SaveAlliance($response, $allianceId) {
$esiHelper = new Esi;
$alliance = new AllianceLookup;
$alliance->alliance_id = $allianceId;
$alliance->creator_corporation_id = $response->creator_corporation_id;
$alliance->creator_id = $response->creator_id;
$alliance->date_founded = $response->date_founded;
$alliance->date_founded = $esiHelper->DecodeDate($response->date_founded);
if(isset($response->executor_corporation_id)) {
$alliance->executor_corporation_id = $response->executor_corporation_id;
}

View File

@@ -16,7 +16,7 @@ class NewLookupTables extends Migration
if(!Schema::hasTable('character_lookup')) {
Schema::create('character_lookup', function (Blueprint $table) {
$table->unsignedInteger('character_id');
$table->unsignedInteger('alliance_id');
$table->unsignedInteger('alliance_id')->nullable();
$table->unsignedInteger('ancestry_id')->nullable();
$table->string('birthday');
$table->unsignedInteger('bloodline_id');
@@ -47,7 +47,10 @@ class NewLookupTables extends Migration
$table->decimal('tax_rate', 20, 2);
$table->string('ticker');
$table->string('url')->nullable();
$table->boolean('war_eligible');
$table->enum('war_eligible', [
'Yes',
'No',
])->default('No');
});
}

View File

@@ -1,16 +1,27 @@
@extends('layouts.b4')
@section('content')
<div class="container">
{!! Form::open(['action' => 'Blacklist\BlacklistController@AddToBlacklist', 'method' => 'POST']) !!}
<div class="form-group">
{{ Form::label('name', 'Character Name') }}
{{ Form::text('name', '', ['class' => 'form-control', 'placeholder' => 'CCP Antiquarian']) }}
<div class="card">
<div class="card-header">
<h2>Add User to the Blacklist</h2>
</div>
<div class="card-body">
{!! Form::open(['action' => 'Blacklist\BlacklistController@AddToBlacklist', 'method' => 'POST']) !!}
<div class="form-group">
{{ Form::label('name', 'Character Name') }}
{{ Form::text('name', '', ['class' => 'form-control', 'placeholder' => 'CCP Antiquarian']) }}
</div>
<div class="form-group">
{{ Form::label('reason', 'Reason') }}
{{ Form::textarea('reason', 'No reason given.', ['class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('alts', 'Known Alts') }}
{{ Form::textarea('alts', '', ['class' => 'form-control']) }}
</div>
{{ Form::submit('Submit', ['class' => 'btn btn-primary']) }}
{!! Form::close() !!}
</div>
</div>
<div class="form-group">
{{ Form::label('reason', 'Reason') }}
{{ Form::textarea('reason', 'N/A', ['class' => 'form-control']) }}
</div>
{{ Form::submit('Submit', ['class' => 'btn btn-primary']) }}
{!! Form::close() !!}
</div>
@endsection