From 73f76aea466503adcca385da8c1d06bb7e7e8b1b Mon Sep 17 00:00:00 2001 From: Matt Burchett Date: Wed, 7 Apr 2021 23:37:02 -0700 Subject: [PATCH] Adding Ship Type Dropdown --- .idea/eliteregistry.iml | 1 + .idea/php.xml | 1 + app/Http/Controllers/ShipsController.php | 5 +- app/Models/EliteShips.php | 11 +++ composer.json | 3 +- composer.lock | 74 ++++++++++++++- config/app.php | 3 + ..._04_08_042412_create_elite_ships_table.php | 33 +++++++ .../2021_04_08_042901_add_elite_ships.php | 88 ++++++++++++++++++ resources/views/ships/index.blade.php | 12 ++- scanner_config.php | 91 +++++++++++++++++++ ships.txt | 54 +++++++++++ 12 files changed, 371 insertions(+), 5 deletions(-) create mode 100644 app/Models/EliteShips.php create mode 100644 database/migrations/2021_04_08_042412_create_elite_ships_table.php create mode 100644 database/migrations/2021_04_08_042901_add_elite_ships.php create mode 100644 scanner_config.php create mode 100644 ships.txt diff --git a/.idea/eliteregistry.iml b/.idea/eliteregistry.iml index b272780..8824452 100644 --- a/.idea/eliteregistry.iml +++ b/.idea/eliteregistry.iml @@ -117,6 +117,7 @@ + diff --git a/.idea/php.xml b/.idea/php.xml index 7b8d2a8..47252fe 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -112,6 +112,7 @@ + diff --git a/app/Http/Controllers/ShipsController.php b/app/Http/Controllers/ShipsController.php index 37a73fb..ec715d9 100644 --- a/app/Http/Controllers/ShipsController.php +++ b/app/Http/Controllers/ShipsController.php @@ -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){ diff --git a/app/Models/EliteShips.php b/app/Models/EliteShips.php new file mode 100644 index 0000000..12f98e0 --- /dev/null +++ b/app/Models/EliteShips.php @@ -0,0 +1,11 @@ +=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", diff --git a/config/app.php b/config/app.php index a51af0b..53fe0fa 100644 --- a/config/app.php +++ b/config/app.php @@ -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, ], diff --git a/database/migrations/2021_04_08_042412_create_elite_ships_table.php b/database/migrations/2021_04_08_042412_create_elite_ships_table.php new file mode 100644 index 0000000..7b63d2d --- /dev/null +++ b/database/migrations/2021_04_08_042412_create_elite_ships_table.php @@ -0,0 +1,33 @@ +id(); + $table->string('shipName'); + $table->string('shipClass'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('elite_ships'); + } +} diff --git a/database/migrations/2021_04_08_042901_add_elite_ships.php b/database/migrations/2021_04_08_042901_add_elite_ships.php new file mode 100644 index 0000000..2e66cb7 --- /dev/null +++ b/database/migrations/2021_04_08_042901_add_elite_ships.php @@ -0,0 +1,88 @@ +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() + { + // + } +} diff --git a/resources/views/ships/index.blade.php b/resources/views/ships/index.blade.php index 57011c7..58464e1 100644 --- a/resources/views/ships/index.blade.php +++ b/resources/views/ships/index.blade.php @@ -99,7 +99,11 @@
- +
@@ -166,7 +170,11 @@
- +
diff --git a/scanner_config.php b/scanner_config.php new file mode 100644 index 0000000..81cca9d --- /dev/null +++ b/scanner_config.php @@ -0,0 +1,91 @@ + $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 +]; + diff --git a/ships.txt b/ships.txt new file mode 100644 index 0000000..14d410b --- /dev/null +++ b/ships.txt @@ -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