Redirect to the subfleet aircraft list on save #932

This commit is contained in:
Nabeel Shahzad 2020-11-26 13:15:56 -05:00
parent 9cf07c47c7
commit a7981c0a87
2 changed files with 3 additions and 2 deletions

View File

@ -160,6 +160,7 @@ class AircraftController extends Controller
*/ */
public function update($id, UpdateAircraftRequest $request) public function update($id, UpdateAircraftRequest $request)
{ {
/** @var \App\Models\Aircraft $aircraft */
$aircraft = $this->aircraftRepo->findWithoutFail($id); $aircraft = $this->aircraftRepo->findWithoutFail($id);
if (empty($aircraft)) { if (empty($aircraft)) {
@ -171,7 +172,7 @@ class AircraftController extends Controller
$this->aircraftRepo->update($attrs, $id); $this->aircraftRepo->update($attrs, $id);
Flash::success('Aircraft updated successfully.'); Flash::success('Aircraft updated successfully.');
return redirect(route('admin.aircraft.index')); return redirect(route('admin.aircraft.index').'?subfleet='.$aircraft->subfleet_id);
} }
/** /**
@ -183,6 +184,7 @@ class AircraftController extends Controller
*/ */
public function destroy($id) public function destroy($id)
{ {
/** @var \App\Models\Aircraft $aircraft */
$aircraft = $this->aircraftRepo->findWithoutFail($id); $aircraft = $this->aircraftRepo->findWithoutFail($id);
if (empty($aircraft)) { if (empty($aircraft)) {

View File

@ -96,7 +96,6 @@
<div class="form-group col-sm-12"> <div class="form-group col-sm-12">
<div class="pull-right"> <div class="pull-right">
{{ Form::button('Save', ['type' => 'submit', 'class' => 'btn btn-success']) }} {{ Form::button('Save', ['type' => 'submit', 'class' => 'btn btn-success']) }}
<a href="{{ route('admin.aircraft.index') }}" class="btn btn-default">Cancel</a>
</div> </div>
</div> </div>
</div> </div>