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->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);

View File

@ -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'];
}

View File

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