aircraft fares association code
This commit is contained in:
@@ -120,4 +120,24 @@ class AircraftController extends BaseController
|
||||
|
||||
return redirect(route('admin.aircraft.index'));
|
||||
}
|
||||
|
||||
public function fares(Request $request)
|
||||
{
|
||||
$id = $request->id;
|
||||
|
||||
$aircraft = $this->aircraftRepository->findWithoutFail($id);
|
||||
if (empty($aircraft)) {
|
||||
return view('admin.aircraft.fares')->with('fares', []);
|
||||
}
|
||||
|
||||
// associate or dissociate the fare with this aircraft
|
||||
if ($request->isMethod('post') || $request->isMethod('put')) {
|
||||
|
||||
} elseif ($request->isMethod('delete')) {
|
||||
|
||||
}
|
||||
|
||||
return view('admin.aircraft.fares')
|
||||
->with('fare', $aircraft->fares);
|
||||
}
|
||||
}
|
||||
|
||||
22
resources/views/admin/aircraft/fares.blade.php
Normal file
22
resources/views/admin/aircraft/fares.blade.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<table class="table table-responsive" id="aircraft-fares-table">
|
||||
<thead>
|
||||
<th></th>
|
||||
<th colspan="3">Action</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($fares as $fare)
|
||||
<tr>
|
||||
<td><a href="{!! route('admin.aircraft.show', [$ac->id]) !!}">{!! $ac->icao !!}</a></td>
|
||||
<td>
|
||||
{!! Form::open(['route' => ['admin.aircraft.destroy', $ac->id], 'method' => 'delete']) !!}
|
||||
<div class='btn-group'>
|
||||
<a href="{!! route('admin.aircraft.show', [$ac->id]) !!}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-eye-open"></i></a>
|
||||
<a href="{!! route('admin.aircraft.edit', [$ac->id]) !!}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-edit"></i></a>
|
||||
{!! Form::button('<i class="glyphicon glyphicon-trash"></i>', ['type' => 'submit', 'class' => 'btn btn-danger btn-xs', 'onclick' => "return confirm('Are you sure?')"]) !!}
|
||||
</div>
|
||||
{!! Form::close() !!}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -26,10 +26,14 @@ Route::group([
|
||||
], function () {
|
||||
Route::resource('airports', 'AirportController');
|
||||
Route::resource('airlines', 'AirlinesController');
|
||||
Route::resource('aircraft', 'AircraftController');
|
||||
Route::resource('aircraftclasses', 'AircraftClassController');
|
||||
Route::resource('fares', 'FareController');
|
||||
|
||||
Route::resource('aircraft', 'AircraftController');
|
||||
Route::match(['get', 'post', 'put', 'delete'],
|
||||
'aircraft/{id}/fares',
|
||||
'AircraftController@fares');
|
||||
|
||||
Route::get('', ['uses' => 'DashboardController@index']);
|
||||
Route::get('/', ['uses' => 'DashboardController@index']);
|
||||
Route::get('/dashboard', ['uses' => 'DashboardController@index','name' => 'dashboard']);
|
||||
|
||||
Reference in New Issue
Block a user