Adding Ship Type Dropdown

This commit is contained in:
Matt Burchett 2021-04-07 23:37:02 -07:00
parent 233ff454c3
commit 73f76aea46
12 changed files with 371 additions and 5 deletions

View File

@ -117,6 +117,7 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/blade-ui-kit/blade-icons" />
<excludeFolder url="file://$MODULE_DIR$/vendor/davidhsianturi/blade-bootstrap-icons" />
<excludeFolder url="file://$MODULE_DIR$/vendor/kyslik/column-sortable" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laravelcollective/html" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />

View File

@ -112,6 +112,7 @@
<path value="$PROJECT_DIR$/vendor/blade-ui-kit/blade-icons" />
<path value="$PROJECT_DIR$/vendor/davidhsianturi/blade-bootstrap-icons" />
<path value="$PROJECT_DIR$/vendor/kyslik/column-sortable" />
<path value="$PROJECT_DIR$/vendor/laravelcollective/html" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="7.3">

View File

@ -2,6 +2,8 @@
namespace App\Http\Controllers;
use App\Models\Elite_Ships;
use App\Models\eliteShips;
use App\Models\Ships;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
@ -12,7 +14,8 @@ class ShipsController extends Controller
{
public function index(){
$ships = \App\Models\Ships::sortable()->paginate(10);
return view('ships.index', compact('ships'));
$eliteShips = EliteShips::all();
return view('ships.index', ['ships'=>$ships,'eliteShips'=>$eliteShips]);
}
public function add(Request $request){

11
app/Models/EliteShips.php Normal file
View File

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class EliteShips extends Model
{
use HasFactory;
}

View File

@ -13,7 +13,8 @@
"kyslik/column-sortable": "^6.4",
"laravel/framework": "^8.12",
"laravel/tinker": "^2.5",
"laravel/ui": "^3.2"
"laravel/ui": "^3.2",
"laravelcollective/html": "^6.2"
},
"require-dev": {
"facade/ignition": "^2.5",

74
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "b42acb136b54e4004cc56217508afde1",
"content-hash": "21b163e4dd47a287cb1b862512b9d429",
"packages": [
{
"name": "asm89/stack-cors",
@ -1383,6 +1383,78 @@
},
"time": "2021-01-06T19:20:22+00:00"
},
{
"name": "laravelcollective/html",
"version": "v6.2.1",
"source": {
"type": "git",
"url": "https://github.com/LaravelCollective/html.git",
"reference": "ae15b9c4bf918ec3a78f092b8555551dd693fde3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/LaravelCollective/html/zipball/ae15b9c4bf918ec3a78f092b8555551dd693fde3",
"reference": "ae15b9c4bf918ec3a78f092b8555551dd693fde3",
"shasum": ""
},
"require": {
"illuminate/http": "^6.0|^7.0|^8.0",
"illuminate/routing": "^6.0|^7.0|^8.0",
"illuminate/session": "^6.0|^7.0|^8.0",
"illuminate/support": "^6.0|^7.0|^8.0",
"illuminate/view": "^6.0|^7.0|^8.0",
"php": ">=7.2.5"
},
"require-dev": {
"illuminate/database": "^6.0|^7.0|^8.0",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~8.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "6.x-dev"
},
"laravel": {
"providers": [
"Collective\\Html\\HtmlServiceProvider"
],
"aliases": {
"Form": "Collective\\Html\\FormFacade",
"Html": "Collective\\Html\\HtmlFacade"
}
}
},
"autoload": {
"psr-4": {
"Collective\\Html\\": "src/"
},
"files": [
"src/helpers.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Adam Engebretson",
"email": "adam@laravelcollective.com"
},
{
"name": "Taylor Otwell",
"email": "taylorotwell@gmail.com"
}
],
"description": "HTML and Form Builders for the Laravel Framework",
"homepage": "https://laravelcollective.com",
"support": {
"issues": "https://github.com/LaravelCollective/html/issues",
"source": "https://github.com/LaravelCollective/html"
},
"time": "2020-12-15T20:20:05+00:00"
},
{
"name": "league/commonmark",
"version": "1.5.8",

View File

@ -162,6 +162,7 @@ return [
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
Kyslik\ColumnSortable\ColumnSortableServiceProvider::class,
Collective\Html\HtmlServiceProvider::class,
/*
* Package Service Providers...
@ -228,6 +229,8 @@ return [
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
],

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateEliteShipsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('elite_ships', function (Blueprint $table) {
$table->id();
$table->string('shipName');
$table->string('shipClass');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('elite_ships');
}
}

View File

@ -0,0 +1,88 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddEliteShips extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
\Illuminate\Support\Facades\DB::table('elite_ships')
->insert(array(
// Small Ships
array('shipName'=>'Adder', 'shipClass'=>'S'),
array('shipName'=>'Cobra MkIII', 'shipClass'=>'S'),
array('shipName'=>'Cobra MkIV', 'shipClass'=>'S'),
array('shipName'=>'Diamondback Scout', 'shipClass'=>'S'),
array('shipName'=>'Diamondback Explorer', 'shipClass'=>'S'),
array('shipName'=>'Dolphin', 'shipClass'=>'S'),
array('shipName'=>'Eagle MkII', 'shipClass'=>'S'),
array('shipName'=>'Hauler', 'shipClass'=>'S'),
array('shipName'=>'Imperial Courier', 'shipClass'=>'S'),
array('shipName'=>'Imperial Eagle', 'shipClass'=>'S'),
array('shipName'=>'Sidewinder MkI', 'shipClass'=>'S'),
array('shipName'=>'Viper MkIII', 'shipClass'=>'S'),
array('shipName'=>'Viper MkIV', 'shipClass'=>'S'),
array('shipName'=>'Vulture', 'shipClass'=>'S'),
// Medium Ships
array('shipName'=>'Alliance Challenger', 'shipClass'=>'M'),
array('shipName'=>'Alliance Chieftain', 'shipClass'=>'M'),
array('shipName'=>'Alliance Crusader', 'shipClass'=>'M'),
array('shipName'=>'Asp Explorer', 'shipClass'=>'M'),
array('shipName'=>'Asp Scout', 'shipClass'=>'M'),
array('shipName'=>'Federal Assault Ship', 'shipClass'=>'M'),
array('shipName'=>'Federal Dropship', 'shipClass'=>'M'),
array('shipName'=>'Federal Gunship', 'shipClass'=>'M'),
array('shipName'=>'Fer-de-Lance', 'shipClass'=>'M'),
array('shipName'=>'Keelback', 'shipClass'=>'M'),
array('shipName'=>'Krait MkII', 'shipClass'=>'M'),
array('shipName'=>'Krait Phantom', 'shipClass'=>'M'),
array('shipName'=>'Mamba', 'shipClass'=>'M'),
array('shipName'=>'Python', 'shipClass'=>'M'),
array('shipName'=>'Type-6 Transporter', 'shipClass'=>'M'),
// Large Ships
array('shipName'=>'Anaconda', 'shipClass'=>'L'),
array('shipName'=>'Beluga Liner', 'shipClass'=>'L'),
array('shipName'=>'Federal Corvette', 'shipClass'=>'L'),
array('shipName'=>'Imperial Cutter', 'shipClass'=>'L'),
array('shipName'=>'Imperial Clipper', 'shipClass'=>'L'),
array('shipName'=>'Orca', 'shipClass'=>'L'),
array('shipName'=>'Type-7 Transporter', 'shipClass'=>'L'),
array('shipName'=>'Type-9 Heavy', 'shipClass'=>'L'),
array('shipName'=>'Type-10 Defender', 'shipClass'=>'L'),
// Other Ships
array('shipName'=>'F63 Condor', 'shipClass'=>'O'),
array('shipName'=>'Gu-97', 'shipClass'=>'O'),
array('shipName'=>'Taipan', 'shipClass'=>'O'),
array('shipName'=>'XG7 Trident', 'shipClass'=>'O'),
array('shipName'=>'XG8 Javelin', 'shipClass'=>'O'),
array('shipName'=>'XG9 Lance', 'shipClass'=>'O'),
// Carrier Ships
array('shipName'=>'Drake-Class Carrier', 'shipClass'=>'C')
));
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -99,7 +99,11 @@
</div>
<div class="form-group">
<label for="shipType">Ship Type</label>
<input name="shipType" type="text" class="form-control" id="shipType" value="{{ $ship->shipType }}" required>
<select name="shipType" for="shipType" class="form-control">
@foreach($eliteShips as $eliteShip)
<option value="{{$eliteShip->shipName}}">{{$eliteShip->shipName}}</option>
@endforeach
</select>
</div>
<div class="form-group">
<label for="shipOwner">Ship Owner</label>
@ -166,7 +170,11 @@
</div>
<div class="form-group">
<label for="shipType">Ship Type</label>
<input name="shipType" type="text" class="form-control" id="shipType" required>
<select name="shipType" for="shipType" class="form-control">
@foreach($eliteShips as $eliteShip)
<option value="{{$eliteShip->shipName}}">{{$eliteShip->shipName}}</option>
@endforeach
</select>
</div>
<div class="form-group">
<label for="shipOwner">Ship Owner</label>

91
scanner_config.php Normal file
View File

@ -0,0 +1,91 @@
<?php
/**
* Set $projectPath = getcwd(); if your put it under project root
**/
$projectPath = __DIR__;
/**
* Array of full directories path for scan;
* Scan will be recursive
* Put directories with most intensive imports in top of list for more quick result
* @see http://api.symfony.com/4.0/Symfony/Component/Finder/Finder.html#method_in
**/
$scanDirectories = [
$projectPath,
];
$scanFiles = [
$projectPath . '/autocomplete.php',
];
/**
* Names relative to ones of scanDirectories
*
* @see http://api.symfony.com/4.0/Symfony/Component/Finder/Finder.html#method_exclude
**/
$excludeDirectories = [
'runtime',
'storage/logs',
];
return [
/**
* Required params
**/
'composerJsonPath' => $projectPath . '/composer.json',
'vendorPath' => $projectPath . '/vendor/',
'scanDirectories' => $scanDirectories,
/**
* Optional params
**/
'skipPackages' => [], //List of packages that must be excluded from verification
'excludeDirectories' => $excludeDirectories,
'scanFiles' => $scanFiles,
'extensions' => ['*.php'],
'requireDev' => false, //Check composer require-dev section, default false
/**
* Optional, custom logic for check is file contains definitions of package
*
* @example
* 'customMatch'=> function($definition, $packageName, \Symfony\Component\Finder\SplFileInfo $file):bool{
* $isPresent = false;
* if($packageName === 'phpunit/phpunit'){
* $isPresent = true;
* }
* if($file->getExtension()==='twig'){
* $isPresent = customCheck();
* }
* return $isPresent;
* }
**/
'customMatch'=> null,
/**
* Report mode options
* Report mode enabled, when reportPath value is valid directory path
* !!!Note!!! The scanning time and memory usage will be increased when report mode enabled,
* it sensitive especially for big projects and when requireDev option enabled
**/
'reportPath' => null, //path in directory, where usage report will be stores;
/**
* Optional custom formatter (by default report stored as json)
* $report array format
* [
* 'packageName'=> [
* 'definition'=>['fileNames',...]
* ....
* ]
* ...
* ]
*
* @example
* 'reportFormatter'=>function(array $report):string{
* return print_r($report, true);
* }
**/
'reportFormatter'=>null,
'reportExtension'=>null, //by default - json, set own, if use custom formatter
];

54
ships.txt Normal file
View File

@ -0,0 +1,54 @@
- S
Adder
Cobra MkIII
Cobra MkIV
Diamondback Scout
Diamondback Explorer
Dolphin
Eagle MkII
Hauler
Imperial Courier
Imperial Eagle
Sidewinder MkI
Viper MkIII
Viper MkIV
Vulture
- M
Alliance Challenger
Alliance Chieftain
Alliance Crusader
Asp Explorer
Asp Scout
Federal Assault Ship
Federal Dropship
Federal Gunship
Fer-de-Lance
Keelback
Krait MkII
Krait Phantom
Mamba
Python
Type-6 Transporter
- L
Anaconda
Beluga Liner
Federal Corvette
Imperial Clipper
Imperial Cutter
Orca
Type-7 Transporter
Type-9 Heavy
Type-10 Defender
- O
F63 Condor
Gu-97
Taipan
XG7 Trident
XG8 Javelin
XG9 Lance
- C
Drake-Class Carrier