diff --git a/app/Http/Controllers/Admin/AircraftController.php b/app/Http/Controllers/Admin/AircraftController.php index e4a57104..faeed858 100644 --- a/app/Http/Controllers/Admin/AircraftController.php +++ b/app/Http/Controllers/Admin/AircraftController.php @@ -55,8 +55,11 @@ class AircraftController extends BaseController */ public function store(CreateAircraftRequest $request) { - $input = $request->all(); - $aircraft = $this->aircraftRepository->create($input); + $attrs = $request->all(); + + $attrs['active'] = get_truth_state($attrs['active']); + + $aircraft = $this->aircraftRepository->create($attrs); Flash::success('Aircraft saved successfully.'); return redirect(route('admin.aircraft.edit', ['id' => $aircraft->id])); @@ -110,7 +113,10 @@ class AircraftController extends BaseController return redirect(route('admin.aircraft.index')); } - $this->aircraftRepository->update($request->all(), $id); + $attrs = $request->all(); + $attrs['active'] = get_truth_state($attrs['active']); + + $this->aircraftRepository->update($attrs, $id); Flash::success('Aircraft updated successfully.'); return redirect(route('admin.aircraft.index')); diff --git a/resources/views/admin/aircraft/fields.blade.php b/resources/views/admin/aircraft/fields.blade.php index ee820837..ed5561a6 100644 --- a/resources/views/admin/aircraft/fields.blade.php +++ b/resources/views/admin/aircraft/fields.blade.php @@ -38,8 +38,8 @@ {!! Form::label('active', 'Active:') !!}
diff --git a/resources/views/admin/aircraft/table.blade.php b/resources/views/admin/aircraft/table.blade.php index f9427833..9a4a56a0 100644 --- a/resources/views/admin/aircraft/table.blade.php +++ b/resources/views/admin/aircraft/table.blade.php @@ -27,7 +27,7 @@ {!! Utils::minutesToTimeString($ac->flight_hours) !!} - @if($ac->active === GenericState::ACTIVE) + @if($ac->active == GenericState::ACTIVE) {!! GenericState::label($ac->active); !!} @else Inactive