DB Migrations, adding ship type
Some checks reported errors
continuous-integration/drone/push Build was killed

This commit is contained in:
Matt Burchett 2021-04-07 01:07:09 -07:00
parent 5edf298758
commit 64cb718ac4
3 changed files with 16 additions and 4 deletions

View File

@ -24,6 +24,7 @@ class ShipsController extends Controller
$ship->shipId = strtoupper(request('shipId')); $ship->shipId = strtoupper(request('shipId'));
$ship->shipName = request('shipName'); $ship->shipName = request('shipName');
$ship->shipOwner = request('shipOwner'); $ship->shipOwner = request('shipOwner');
$ship->shipType = request('shipType');
$ship->created_at = now(); $ship->created_at = now();
$ship->save(); $ship->save();
}catch(\Exception $e){ }catch(\Exception $e){
@ -54,7 +55,8 @@ class ShipsController extends Controller
DB::table('ships')->where('id', $request->get('editShip'))->update(array( DB::table('ships')->where('id', $request->get('editShip'))->update(array(
'shipId' => strtoupper(request('shipId')), 'shipId' => strtoupper(request('shipId')),
'shipName' => request('shipName'), 'shipName' => request('shipName'),
'shipOwner' => request('shipOwner') 'shipOwner' => request('shipOwner'),
'shipType' => request('shipType')
)); ));
}catch(\Exception $e){ }catch(\Exception $e){
Log::error($e); Log::error($e);

View File

@ -10,6 +10,6 @@ use Kyslik\ColumnSortable\Sortable;
class Ships extends Model class Ships extends Model
{ {
use Sortable; use Sortable;
public $sortable = ['shipId', 'shipName', 'shipOwner']; public $sortable = ['shipId', 'shipName', 'shipOwner', 'shipType'];
protected $casts = ['id' => 'string']; protected $casts = ['id' => 'string'];
} }

View File

@ -58,6 +58,7 @@
<tr> <tr>
<th scope="col">@sortablelink('shipId', 'Ship ID')</th> <th scope="col">@sortablelink('shipId', 'Ship ID')</th>
<th scope="col">@sortablelink('shipName', 'Ship Name')</th> <th scope="col">@sortablelink('shipName', 'Ship Name')</th>
<th scope="col">@sortablelink('shipType', 'Ship Type')</th>
<th scope="col">@sortablelink('shipOwner', 'Ship Owner')</th> <th scope="col">@sortablelink('shipOwner', 'Ship Owner')</th>
<th scope="col">Actions</th> <th scope="col">Actions</th>
</tr> </tr>
@ -67,6 +68,7 @@
<tr> <tr>
<td>{{ $ship->shipId }}</td> <td>{{ $ship->shipId }}</td>
<td>{{ $ship->shipName }}</td> <td>{{ $ship->shipName }}</td>
<td>{{ $ship->shipType }}</td>
<td>{{ $ship->shipOwner }}</td> <td>{{ $ship->shipOwner }}</td>
<td> <td>
<button type="button" class="btn bi bi-wrench" data-target="#editShip-{{ $ship->id }}" data-toggle="modal"><x-bi-tools/></button> <button type="button" class="btn bi bi-wrench" data-target="#editShip-{{ $ship->id }}" data-toggle="modal"><x-bi-tools/></button>
@ -95,6 +97,10 @@
<label for="shipName">Ship Name</label> <label for="shipName">Ship Name</label>
<input name="shipName" type="text" class="form-control" id="shipName" value="{{ $ship->shipName }}" required> <input name="shipName" type="text" class="form-control" id="shipName" value="{{ $ship->shipName }}" required>
</div> </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>
</div>
<div class="form-group"> <div class="form-group">
<label for="shipOwner">Ship Owner</label> <label for="shipOwner">Ship Owner</label>
<input name="shipOwner" type="text" class="form-control" id="shipOwner" value="{{ $ship->shipOwner }}" required> <input name="shipOwner" type="text" class="form-control" id="shipOwner" value="{{ $ship->shipOwner }}" required>
@ -158,6 +164,10 @@
<label for="shipName">Ship Name</label> <label for="shipName">Ship Name</label>
<input name="shipName" type="text" class="form-control" id="shipName" required> <input name="shipName" type="text" class="form-control" id="shipName" required>
</div> </div>
<div class="form-group">
<label for="shipType">Ship Type</label>
<input name="shipType" type="text" class="form-control" id="shipType" required>
</div>
<div class="form-group"> <div class="form-group">
<label for="shipOwner">Ship Owner</label> <label for="shipOwner">Ship Owner</label>
<input name="shipOwner" type="text" class="form-control" id="shipOwner" required> <input name="shipOwner" type="text" class="form-control" id="shipOwner" required>