From 64cb718ac4d5290d6c276d2fb36b0b92cbc39612 Mon Sep 17 00:00:00 2001 From: Matt Burchett Date: Wed, 7 Apr 2021 01:07:09 -0700 Subject: [PATCH] DB Migrations, adding ship type --- app/Http/Controllers/ShipsController.php | 4 +++- app/Models/Ships.php | 2 +- resources/views/ships/index.blade.php | 14 ++++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/ShipsController.php b/app/Http/Controllers/ShipsController.php index 70ced6b..37a73fb 100644 --- a/app/Http/Controllers/ShipsController.php +++ b/app/Http/Controllers/ShipsController.php @@ -24,6 +24,7 @@ class ShipsController extends Controller $ship->shipId = strtoupper(request('shipId')); $ship->shipName = request('shipName'); $ship->shipOwner = request('shipOwner'); + $ship->shipType = request('shipType'); $ship->created_at = now(); $ship->save(); }catch(\Exception $e){ @@ -54,7 +55,8 @@ class ShipsController extends Controller DB::table('ships')->where('id', $request->get('editShip'))->update(array( 'shipId' => strtoupper(request('shipId')), 'shipName' => request('shipName'), - 'shipOwner' => request('shipOwner') + 'shipOwner' => request('shipOwner'), + 'shipType' => request('shipType') )); }catch(\Exception $e){ Log::error($e); diff --git a/app/Models/Ships.php b/app/Models/Ships.php index 17d85aa..868bd6f 100644 --- a/app/Models/Ships.php +++ b/app/Models/Ships.php @@ -10,6 +10,6 @@ use Kyslik\ColumnSortable\Sortable; class Ships extends Model { use Sortable; - public $sortable = ['shipId', 'shipName', 'shipOwner']; + public $sortable = ['shipId', 'shipName', 'shipOwner', 'shipType']; protected $casts = ['id' => 'string']; } diff --git a/resources/views/ships/index.blade.php b/resources/views/ships/index.blade.php index 644e203..57011c7 100644 --- a/resources/views/ships/index.blade.php +++ b/resources/views/ships/index.blade.php @@ -58,6 +58,7 @@ @sortablelink('shipId', 'Ship ID') @sortablelink('shipName', 'Ship Name') + @sortablelink('shipType', 'Ship Type') @sortablelink('shipOwner', 'Ship Owner') Actions @@ -67,6 +68,7 @@ {{ $ship->shipId }} {{ $ship->shipName }} + {{ $ship->shipType }} {{ $ship->shipOwner }} @@ -93,11 +95,15 @@
- + +
+
+ +
- +
+
+ + +