solar system seeder and flex structure views

This commit is contained in:
2019-12-06 21:33:16 -06:00
parent b78675718d
commit 3c43289e98
8 changed files with 79 additions and 7 deletions

View File

@@ -91,6 +91,14 @@ class FlexAdminController extends Controller
'system' => 'required', 'system' => 'required',
'structure_type' => 'required', 'structure_type' => 'required',
]); ]);
FlexStructure::where([
'requestor_name' => $request->requestor_name,
'system' => $request->system,
'structure_type' => $request->structure_type,
])->delete();
return redirect('/flex/display')->with('success', 'Flex Structure Entry Removed.');
} }
} }

View File

@@ -12,10 +12,6 @@ class DatabaseSeeder extends Seeder
*/ */
public function run() public function run()
{ {
$this->call([ $this->call(SolarSystemSeeder::class);
WikiTableSeeder::class,
ConfigTableSeeder::class,
OrePricesSeeder::class,
]);
} }
} }

View File

@@ -0,0 +1,47 @@
<?php
use Illuminate\Database\Seeder;
use App\Models\Lookups\SolarSystem;
use Seat\Eseye\Cache\NullCache;
use Seat\Eseye\Configuration;
use Seat\Eseye\Containers\EsiAuthentication;
use Seat\Eseye\Eseye;
class SolarSystemSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$configuration = Configuration::getInstance();
$configuration->cache = NullCache::class;
$esi = new Eseye();
$systems = $esi->invoke('get', '/universe/systems/');
foreach($systems as $system) {
try {
$info = $esi->invoke('get', '/universe/systems/{system_id}/', [
'system_id' => $system,
]);
} catch(RequestFailedException $e) {
}
$count = SolarSystem::where(['solar_system_id' => $system])->count();
if($count == 0) {
SolarSystem::insert([
'name' => $info->name,
'solar_system_id' => $system,
'security_status' => $info->security_status,
]);
}
}
}
}

View File

@@ -21,7 +21,12 @@
</div> </div>
<div class="form-group"> <div class="form-group">
{{ Form::label('structure_type', 'Structure Type') }} {{ Form::label('structure_type', 'Structure Type') }}
{{ Form::select('structure_type', '', ['class' => 'form-control']) }} {{ Form::select('structure_type', [
'Cyno Jammer' => 'Cyno Jammer',
'Cyno Beacon' => 'Cyno Beacon',
'Jump Bridge' => 'Jump Bridge',
'Super Construction Facilities' => 'Super Construction Facilities',
], 'None', ['class' => 'form-control']) }}
</div> </div>
<div class="form-group"> <div class="form-group">
{{ Form::label('structure_cost', 'Structure Cost') }} {{ Form::label('structure_cost', 'Structure Cost') }}

View File

@@ -8,6 +8,7 @@
</div> </div>
<div class="card-body"> <div class="card-body">
@if($structures != null) @if($structures != null)
{!! Form::open(['action' => 'Flex\FlexAdminController@removeFlexStructure', 'method' => 'POST']) !!}
<table class="table table-bordered table-striped"> <table class="table table-bordered table-striped">
<thead> <thead>
<th>Requestor</th> <th>Requestor</th>
@@ -15,6 +16,7 @@
<th>System</th> <th>System</th>
<th>Structure Type</th> <th>Structure Type</th>
<th>Cost</th> <th>Cost</th>
<th>Remove?</th>
</thead> </thead>
<tbody> <tbody>
@foreach($structures as $structure) @foreach($structures as $structure)
@@ -23,7 +25,13 @@
<td>{{ $structure->requestor_corp_name }}</td> <td>{{ $structure->requestor_corp_name }}</td>
<td>{{ $structure->system }}</td> <td>{{ $structure->system }}</td>
<td>{{ $structure->structure_type }}</td> <td>{{ $structure->structure_type }}</td>
<td>{{ number_format($structure->structure_cost, "2", ".", ",") }} <td>{{ number_format($structure->structure_cost, "2", ".", ",") }}</td>
<td>
{{ Form::radio('remove', 'Yes', false, ['class' => 'form-control']) }}
{{ Form::hidden('requestor_name', $structure->requestor_name) }}
{{ Form::hidden('system', $structure->system) }}
{{ Form::hidden('structure_type', $structure->structure_type) }}
</td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>

View File

@@ -112,6 +112,12 @@
<a class="dropdown-item" href="/admin/dashboard/taxes">Taxes</a> <a class="dropdown-item" href="/admin/dashboard/taxes">Taxes</a>
<a class="dropdown-item" href="/admin/dashboard/logins">Allowed Logins</a> <a class="dropdown-item" href="/admin/dashboard/logins">Allowed Logins</a>
<a class="dropdown-item" href="/admin/dashboard/purgewiki">Wiki Purge</a> <a class="dropdown-item" href="/admin/dashboard/purgewiki">Wiki Purge</a>
<a class="nav-link dropdown-toggle" href="#" id="navbarDropDownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Flex</a>
<div class="dropdown-menu" aria-labelledby="navbarDropDownMenuLink">
<a class="dropdown-item" href="/flex/display">Display</a>
<a class="dropdown-item" href="/flex/display/add">Add</a>
<a class="dropdown-item" href="/flex/display/remove">Remove</a>
</div>
</div> </div>
</li> </li>
@endif @endif

View File

@@ -3729,6 +3729,7 @@ return array(
'SebastianBergmann\\Timer\\RuntimeException' => $vendorDir . '/phpunit/php-timer/src/RuntimeException.php', 'SebastianBergmann\\Timer\\RuntimeException' => $vendorDir . '/phpunit/php-timer/src/RuntimeException.php',
'SebastianBergmann\\Timer\\Timer' => $vendorDir . '/phpunit/php-timer/src/Timer.php', 'SebastianBergmann\\Timer\\Timer' => $vendorDir . '/phpunit/php-timer/src/Timer.php',
'SebastianBergmann\\Version' => $vendorDir . '/sebastian/version/src/Version.php', 'SebastianBergmann\\Version' => $vendorDir . '/sebastian/version/src/Version.php',
'SolarSystemSeeder' => $baseDir . '/database/seeds/SolarSystemSeeder.php',
'Symfony\\Component\\Console\\Application' => $vendorDir . '/symfony/console/Application.php', 'Symfony\\Component\\Console\\Application' => $vendorDir . '/symfony/console/Application.php',
'Symfony\\Component\\Console\\CommandLoader\\CommandLoaderInterface' => $vendorDir . '/symfony/console/CommandLoader/CommandLoaderInterface.php', 'Symfony\\Component\\Console\\CommandLoader\\CommandLoaderInterface' => $vendorDir . '/symfony/console/CommandLoader/CommandLoaderInterface.php',
'Symfony\\Component\\Console\\CommandLoader\\ContainerCommandLoader' => $vendorDir . '/symfony/console/CommandLoader/ContainerCommandLoader.php', 'Symfony\\Component\\Console\\CommandLoader\\ContainerCommandLoader' => $vendorDir . '/symfony/console/CommandLoader/ContainerCommandLoader.php',

View File

@@ -4193,6 +4193,7 @@ class ComposerStaticInitc3f953f8a7291d41a76e1664339777c9
'SebastianBergmann\\Timer\\RuntimeException' => __DIR__ . '/..' . '/phpunit/php-timer/src/RuntimeException.php', 'SebastianBergmann\\Timer\\RuntimeException' => __DIR__ . '/..' . '/phpunit/php-timer/src/RuntimeException.php',
'SebastianBergmann\\Timer\\Timer' => __DIR__ . '/..' . '/phpunit/php-timer/src/Timer.php', 'SebastianBergmann\\Timer\\Timer' => __DIR__ . '/..' . '/phpunit/php-timer/src/Timer.php',
'SebastianBergmann\\Version' => __DIR__ . '/..' . '/sebastian/version/src/Version.php', 'SebastianBergmann\\Version' => __DIR__ . '/..' . '/sebastian/version/src/Version.php',
'SolarSystemSeeder' => __DIR__ . '/../..' . '/database/seeds/SolarSystemSeeder.php',
'Symfony\\Component\\Console\\Application' => __DIR__ . '/..' . '/symfony/console/Application.php', 'Symfony\\Component\\Console\\Application' => __DIR__ . '/..' . '/symfony/console/Application.php',
'Symfony\\Component\\Console\\CommandLoader\\CommandLoaderInterface' => __DIR__ . '/..' . '/symfony/console/CommandLoader/CommandLoaderInterface.php', 'Symfony\\Component\\Console\\CommandLoader\\CommandLoaderInterface' => __DIR__ . '/..' . '/symfony/console/CommandLoader/CommandLoaderInterface.php',
'Symfony\\Component\\Console\\CommandLoader\\ContainerCommandLoader' => __DIR__ . '/..' . '/symfony/console/CommandLoader/ContainerCommandLoader.php', 'Symfony\\Component\\Console\\CommandLoader\\ContainerCommandLoader' => __DIR__ . '/..' . '/symfony/console/CommandLoader/ContainerCommandLoader.php',