#32 subfleet classificiation scaffolding
This commit is contained in:
parent
6bbb37061b
commit
aaaead77a5
@ -1,149 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Requests\CreateAircraftClassRequest;
|
||||
use App\Http\Requests\UpdateAircraftClassRequest;
|
||||
use App\Repositories\AircraftClassRepository;
|
||||
use Illuminate\Http\Request;
|
||||
use Flash;
|
||||
use Prettus\Repository\Criteria\RequestCriteria;
|
||||
use Response;
|
||||
|
||||
class AircraftClassController extends BaseController
|
||||
{
|
||||
/** @var AircraftClassRepository */
|
||||
private $aircraftClassRepository;
|
||||
|
||||
public function __construct(AircraftClassRepository $aircraftClassRepo)
|
||||
{
|
||||
$this->aircraftClassRepository = $aircraftClassRepo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the AircraftClass.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$this->aircraftClassRepository->pushCriteria(new RequestCriteria($request));
|
||||
$aircraftClasses = $this->aircraftClassRepository->all();
|
||||
|
||||
return view('admin.aircraft_classes.index')
|
||||
->with('aircraftClasses', $aircraftClasses);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new AircraftClass.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('admin.aircraft_classes.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created AircraftClass in storage.
|
||||
*
|
||||
* @param CreateAircraftClassRequest $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function store(CreateAircraftClassRequest $request)
|
||||
{
|
||||
$input = $request->all();
|
||||
$aircraftClass = $this->aircraftClassRepository->create($input);
|
||||
|
||||
Flash::success('Aircraft Class saved successfully.');
|
||||
|
||||
return redirect(route('admin.aircraftClasses.index'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified AircraftClass.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$aircraftClass = $this->aircraftClassRepository->findWithoutFail($id);
|
||||
|
||||
if (empty($aircraftClass)) {
|
||||
Flash::error('Aircraft Class not found');
|
||||
return redirect(route('admin.aircraftClasses.index'));
|
||||
}
|
||||
|
||||
return view('admin.aircraft_classes.show')->with('aircraftClass', $aircraftClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified AircraftClass.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$aircraftClass = $this->aircraftClassRepository->findWithoutFail($id);
|
||||
|
||||
if (empty($aircraftClass)) {
|
||||
Flash::error('Aircraft Class not found');
|
||||
return redirect(route('admin.aircraftClasses.index'));
|
||||
}
|
||||
|
||||
return view('admin.aircraft_classes.edit')->with('aircraftClass', $aircraftClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified AircraftClass in storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @param UpdateAircraftClassRequest $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function update($id, UpdateAircraftClassRequest $request)
|
||||
{
|
||||
$aircraftClass = $this->aircraftClassRepository->findWithoutFail($id);
|
||||
|
||||
if (empty($aircraftClass)) {
|
||||
Flash::error('Aircraft Class not found');
|
||||
return redirect(route('admin.aircraftClasses.index'));
|
||||
}
|
||||
|
||||
$aircraftClass = $this->aircraftClassRepository->update($request->all(), $id);
|
||||
|
||||
Flash::success('Aircraft Class updated successfully.');
|
||||
|
||||
return redirect(route('admin.aircraftClasses.index'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified AircraftClass from storage.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$aircraftClass = $this->aircraftClassRepository->findWithoutFail($id);
|
||||
|
||||
if (empty($aircraftClass)) {
|
||||
Flash::error('Aircraft Class not found');
|
||||
return redirect(route('admin.aircraftClasses.index'));
|
||||
}
|
||||
|
||||
$this->aircraftClassRepository->delete($id);
|
||||
|
||||
Flash::success('Aircraft Class deleted successfully.');
|
||||
|
||||
return redirect(route('admin.aircraftClasses.index'));
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Models\Subfleet;
|
||||
use App\Http\Requests\CreateAircraftRequest;
|
||||
use App\Http\Requests\UpdateAircraftRequest;
|
||||
use App\Repositories\AircraftRepository;
|
||||
@ -54,7 +55,9 @@ class AircraftController extends BaseController
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('admin.aircraft.create');
|
||||
return view('admin.aircraft.create', [
|
||||
'subfleets' => Subfleet::all()->pluck('name', 'id'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -84,9 +87,10 @@ class AircraftController extends BaseController
|
||||
|
||||
$avail_fares = $this->getAvailFares($aircraft);
|
||||
|
||||
return view('admin.aircraft.show')
|
||||
->with('aircraft', $aircraft)
|
||||
->with('avail_fares', $avail_fares);
|
||||
return view('admin.aircraft.show', [
|
||||
'aircraft' => $aircraft,
|
||||
'avail_fares' => $avail_fares,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -101,7 +105,10 @@ class AircraftController extends BaseController
|
||||
return redirect(route('admin.aircraft.index'));
|
||||
}
|
||||
|
||||
return view('admin.aircraft.edit')->with('aircraft', $aircraft);
|
||||
return view('admin.aircraft.edit', [
|
||||
'subfleets' => Subfleet::all()->pluck('name', 'id'),
|
||||
'aircraft' => $aircraft,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -147,9 +154,10 @@ class AircraftController extends BaseController
|
||||
$aircraft->refresh();
|
||||
$avail_fares = $this->getAvailFares($aircraft);
|
||||
|
||||
return view('admin.aircraft.fares')
|
||||
->with('aircraft', $aircraft)
|
||||
->with('avail_fares', $avail_fares);
|
||||
return view('admin.aircraft.fares', [
|
||||
'aircraft' => $aircraft,
|
||||
'avail_fares' => $avail_fares,
|
||||
]);
|
||||
}
|
||||
|
||||
public function fares(Request $request)
|
||||
@ -158,7 +166,7 @@ class AircraftController extends BaseController
|
||||
|
||||
$aircraft = $this->aircraftRepository->findWithoutFail($id);
|
||||
if (empty($aircraft)) {
|
||||
return view('admin.aircraft.fares')->with('fares', []);
|
||||
return view('admin.aircraft.fares', ['fares' => []]);
|
||||
}
|
||||
|
||||
$fare_svc = app('App\Services\FareService');
|
||||
|
154
app/Http/Controllers/Admin/SubfleetController.php
Normal file
154
app/Http/Controllers/Admin/SubfleetController.php
Normal file
@ -0,0 +1,154 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Requests;
|
||||
use App\Models\Airline;
|
||||
use App\Http\Requests\CreateSubfleetRequest;
|
||||
use App\Http\Requests\UpdateSubfleetRequest;
|
||||
use App\Repositories\SubfleetRepository;
|
||||
use Illuminate\Http\Request;
|
||||
use Flash;
|
||||
use Prettus\Repository\Criteria\RequestCriteria;
|
||||
use Response;
|
||||
|
||||
class SubfleetController extends BaseController
|
||||
{
|
||||
/** @var SubfleetRepository */
|
||||
private $subfleetRepo;
|
||||
|
||||
public function __construct(SubfleetRepository $subfleetRepo)
|
||||
{
|
||||
$this->subfleetRepo = $subfleetRepo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the Subfleet.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$this->subfleetRepo->pushCriteria(new RequestCriteria($request));
|
||||
$subfleets = $this->subfleetRepo->all();
|
||||
|
||||
return view('admin.subfleets.index', [
|
||||
'subfleets' => $subfleets,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new Subfleet.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('admin.subfleets.create', [
|
||||
'airlines' => Airline::all()->pluck('name', 'id'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created Subfleet in storage.
|
||||
*
|
||||
* @param CreateSubfleetRequest $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function store(CreateSubfleetRequest $request)
|
||||
{
|
||||
$input = $request->all();
|
||||
$subfleet = $this->subfleetRepo->create($input);
|
||||
|
||||
Flash::success('Subfleet saved successfully.');
|
||||
return redirect(route('admin.subfleets.index'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified Subfleet.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$subfleet = $this->subfleetRepo->findWithoutFail($id);
|
||||
|
||||
if (empty($subfleet)) {
|
||||
Flash::error('Subfleet not found');
|
||||
return redirect(route('admin.subfleets.index'));
|
||||
}
|
||||
|
||||
return view('admin.subfleets.show', ['subfleet' => $subfleet]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified Subfleet.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$subfleet = $this->subfleetRepo->findWithoutFail($id);
|
||||
|
||||
if (empty($subfleet)) {
|
||||
Flash::error('Subfleet not found');
|
||||
return redirect(route('admin.subfleets.index'));
|
||||
}
|
||||
|
||||
return view('admin.subfleets.edit', [
|
||||
'airlines' => Airline::all()->pluck('name', 'id'),
|
||||
'subfleet' => $subfleet,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified Subfleet in storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @param UpdateSubfleetRequest $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function update($id, UpdateSubfleetRequest $request)
|
||||
{
|
||||
$subfleet = $this->subfleetRepo->findWithoutFail($id);
|
||||
|
||||
if (empty($subfleet)) {
|
||||
Flash::error('Subfleet not found');
|
||||
return redirect(route('admin.subfleets.index'));
|
||||
}
|
||||
|
||||
$subfleet = $this->subfleetRepo->update($request->all(), $id);
|
||||
|
||||
Flash::success('Subfleet updated successfully.');
|
||||
return redirect(route('admin.subfleets.index'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified Subfleet from storage.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$subfleet = $this->subfleetRepo->findWithoutFail($id);
|
||||
|
||||
if (empty($subfleet)) {
|
||||
Flash::error('Subfleet not found');
|
||||
return redirect(route('admin.subfleets.index'));
|
||||
}
|
||||
|
||||
$this->subfleetRepo->delete($id);
|
||||
|
||||
Flash::success('Subfleet deleted successfully.');
|
||||
return redirect(route('admin.subfleets.index'));
|
||||
}
|
||||
}
|
30
app/Http/Requests/CreateSubfleetRequest.php
Normal file
30
app/Http/Requests/CreateSubfleetRequest.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use App\Models\Subfleet;
|
||||
|
||||
class CreateSubfleetRequest extends Request
|
||||
{
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return Subfleet::$rules;
|
||||
}
|
||||
}
|
30
app/Http/Requests/UpdateSubfleetRequest.php
Normal file
30
app/Http/Requests/UpdateSubfleetRequest.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use App\Models\Subfleet;
|
||||
|
||||
class UpdateSubfleetRequest extends Request
|
||||
{
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return Subfleet::$rules;
|
||||
}
|
||||
}
|
@ -52,22 +52,19 @@ class Aircraft extends Model
|
||||
];
|
||||
|
||||
/**
|
||||
* foreign key
|
||||
* foreign keys
|
||||
*/
|
||||
public function class()
|
||||
{
|
||||
return $this->belongsTo(
|
||||
'App\Models\AircraftClass',
|
||||
'aircraft_class_id'
|
||||
);
|
||||
}
|
||||
|
||||
public function fares()
|
||||
{
|
||||
$r = $this->belongsToMany(
|
||||
return $this->belongsToMany(
|
||||
'App\Models\Fare',
|
||||
'aircraft_fare'
|
||||
)->withPivot('price', 'cost', 'capacity');
|
||||
return $r;
|
||||
}
|
||||
|
||||
public function subfleet()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Subfleet', 'subfleet_id');
|
||||
}
|
||||
}
|
||||
|
@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Eloquent as Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class AircraftClass
|
||||
* @package App\Models
|
||||
* @version June 9, 2017, 8:10 pm UTC
|
||||
*/
|
||||
class AircraftClass extends Model
|
||||
{
|
||||
public $table = 'aircraft_classes';
|
||||
|
||||
protected $dates = ['deleted_at'];
|
||||
|
||||
public $fillable = [
|
||||
'code',
|
||||
'name',
|
||||
'notes'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be casted to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'code' => 'string',
|
||||
'name' => 'string',
|
||||
'notes' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
* Validation rules
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $rules = [
|
||||
'code' => 'required',
|
||||
'name' => 'required'
|
||||
];
|
||||
}
|
@ -8,7 +8,6 @@ use Eloquent as Model;
|
||||
* Class Fare
|
||||
*
|
||||
* @package App\Models
|
||||
* @version June 10, 2017, 4:03 am UTC
|
||||
*/
|
||||
class Fare extends Model
|
||||
{
|
||||
@ -52,6 +51,10 @@ class Fare extends Model
|
||||
'name' => 'required',
|
||||
];
|
||||
|
||||
/**
|
||||
* any foreign keys
|
||||
*/
|
||||
|
||||
public function aircraft() {
|
||||
return $this->belongsToMany(
|
||||
'App\Models\Aircraft',
|
||||
|
@ -42,4 +42,11 @@ class Rank extends Model
|
||||
public static $rules = [
|
||||
'name' => 'unique',
|
||||
];
|
||||
|
||||
public function subfleets() {
|
||||
return $this->belongsToMany(
|
||||
'App\Models\Subfleet',
|
||||
'subfleet_rank'
|
||||
)->withPivot('acars_pay', 'manual_pay');
|
||||
}
|
||||
}
|
||||
|
60
app/Models/Subfleet.php
Normal file
60
app/Models/Subfleet.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Eloquent as Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class Subfleet
|
||||
* @package App\Models
|
||||
*/
|
||||
class Subfleet extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
public $table = 'subfleets';
|
||||
|
||||
|
||||
protected $dates = ['deleted_at'];
|
||||
|
||||
|
||||
public $fillable = [
|
||||
'airline_id',
|
||||
'name',
|
||||
'type'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be casted to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'airline_id' => 'integer',
|
||||
'name' => 'string',
|
||||
'type' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
* Validation rules
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $rules = [
|
||||
|
||||
];
|
||||
|
||||
public function airline()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Airline', 'airline_id');
|
||||
}
|
||||
|
||||
public function ranks()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
'App\Models\Ranks',
|
||||
'subfleet_rank'
|
||||
)->withPivot('acars_pay', 'manual_pay');
|
||||
}
|
||||
}
|
24
app/Repositories/SubfleetRepository.php
Normal file
24
app/Repositories/SubfleetRepository.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Models\Subfleet;
|
||||
use InfyOm\Generator\Common\BaseRepository;
|
||||
|
||||
class SubfleetRepository extends BaseRepository
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $fieldSearchable = [
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* Configure the Model
|
||||
**/
|
||||
public function model()
|
||||
{
|
||||
return Subfleet::class;
|
||||
}
|
||||
}
|
@ -8,4 +8,9 @@ return [
|
||||
*/
|
||||
'currency' => 'dollar',
|
||||
|
||||
'fuel_types' => [
|
||||
'100LL' => 0,
|
||||
'JETA' => 1,
|
||||
'MOGAS' => 2,
|
||||
],
|
||||
];
|
||||
|
@ -14,8 +14,10 @@ class CreateAircraftsTable extends Migration
|
||||
$table->string('name');
|
||||
$table->string('registration')->nullable();
|
||||
$table->string('tail_number')->nullable();
|
||||
$table->string('cargo_capacity')->nullable();
|
||||
$table->string('fuel_capacity')->nullable();
|
||||
$table->double('cargo_capacity', 19, 2)->nullable();
|
||||
$table->double('fuel_capacity', 19, 2)->nullable();
|
||||
$table->double('gross_weight', 19, 2)->nullable();
|
||||
$table->tinyInteger('fuel_type')->unsigned()->nullable();
|
||||
$table->boolean('active')->default(true);
|
||||
$table->timestamps();
|
||||
|
||||
@ -23,20 +25,10 @@ class CreateAircraftsTable extends Migration
|
||||
$table->unique('registration');
|
||||
});
|
||||
|
||||
Schema::create('aircraft_classes', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('code');
|
||||
$table->string('name');
|
||||
$table->string('notes')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index('code');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('aircraft');
|
||||
Schema::drop('aircraft_classes');
|
||||
}
|
||||
}
|
||||
|
@ -24,14 +24,6 @@ class CreateRanksTable extends Migration
|
||||
|
||||
$table->unique('name');
|
||||
});
|
||||
|
||||
Schema::create('aircraft_rank', function(Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('aircraft_id')->unsigned();
|
||||
$table->integer('rank_id')->unsigned();
|
||||
$table->double('acars_pay', 19, 2)->default(0.0)->unsigned();
|
||||
$table->double('manual_pay', 19, 2)->default(0.0)->unsigned();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -42,6 +34,5 @@ class CreateRanksTable extends Migration
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('ranks');
|
||||
Schema::drop('aircraft_rank');
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateSubfleetsTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('subfleets', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('airline_id')->unsigned()->nullable();
|
||||
$table->string('name');
|
||||
$table->text('type');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
|
||||
Schema::create('subfleet_rank', function(Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('subfleet_id')->unsigned()->nullable();
|
||||
$table->integer('rank_id')->unsigned()->nullable();
|
||||
$table->double('acars_pay', 19, 2)->unsigned()->nullable();
|
||||
$table->double('manual_pay', 19, 2)->unsigned()->nullable();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('subfleets');
|
||||
Schema::drop('subfleet_rank');
|
||||
}
|
||||
}
|
@ -70,42 +70,27 @@ airports:
|
||||
lat: 51.4775
|
||||
lon: -0.4614
|
||||
|
||||
#
|
||||
aircraft_classes:
|
||||
- id: 1
|
||||
code: H
|
||||
name: Heavy
|
||||
- id: 2
|
||||
code: M
|
||||
name: Medium
|
||||
- id: 3
|
||||
code: L
|
||||
name: Light
|
||||
|
||||
#
|
||||
aircraft:
|
||||
- id: 1
|
||||
aircraft_class_id: 1
|
||||
icao: B744
|
||||
name: Boeing 747-400
|
||||
registration: NC17
|
||||
tail_number: 17
|
||||
- id: 2
|
||||
aircraft_class_id: 1
|
||||
icao: B772
|
||||
name: Boeing 777-200
|
||||
registration: NC20
|
||||
tail_number: 20
|
||||
|
||||
aircraft_rank:
|
||||
- aircraft_id: 1
|
||||
rank_id: 1
|
||||
- aircraft_id: 1
|
||||
rank_id: 2
|
||||
acars_pay: 100
|
||||
manual_pay: 50
|
||||
#aircraft_rank:
|
||||
# - aircraft_id: 1
|
||||
# rank_id: 1
|
||||
# - aircraft_id: 1
|
||||
# rank_id: 2
|
||||
# acars_pay: 100
|
||||
# manual_pay: 50
|
||||
|
||||
#
|
||||
fares:
|
||||
- id: 1
|
||||
code: Y
|
||||
|
@ -4,7 +4,7 @@
|
||||
<section class="content-header">
|
||||
<h1 class="pull-left">Aircraft</h1>
|
||||
<h1 class="pull-right">
|
||||
<a class="btn btn-primary " style="margin-top: -8px;" href="{!! url('/admin/aircraftclasses') !!}">Aircraft Classes</a>
|
||||
<a class="btn btn-primary " style="margin-top: -8px;" href="{!! url('/admin/subfleets') !!}">Subfleets</a>
|
||||
|
||||
<a class="btn btn-primary " style="margin-top: -8px;" href="{!! route('admin.aircraft.create') !!}">Add New Aircraft</a>
|
||||
</h1>
|
||||
|
@ -1,7 +0,0 @@
|
||||
|
||||
|
||||
<!-- Submit Field -->
|
||||
<div class="form-group col-sm-12">
|
||||
{!! Form::submit('Save', ['class' => 'btn btn-primary']) !!}
|
||||
<a href="{!! route('admin.aircraftClasses.index') !!}" class="btn btn-default">Cancel</a>
|
||||
</div>
|
@ -1,36 +0,0 @@
|
||||
<!-- Id Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('id', 'Id:') !!}
|
||||
<p>{!! $aircraftClass->id !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- Class Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('class', 'Class:') !!}
|
||||
<p>{!! $aircraftClass->class !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- Name Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('name', 'Name:') !!}
|
||||
<p>{!! $aircraftClass->name !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- Notes Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('notes', 'Notes:') !!}
|
||||
<p>{!! $aircraftClass->notes !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- Created At Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('created_at', 'Created At:') !!}
|
||||
<p>{!! $aircraftClass->created_at !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- Updated At Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('updated_at', 'Updated At:') !!}
|
||||
<p>{!! $aircraftClass->updated_at !!}</p>
|
||||
</div>
|
||||
|
@ -1,26 +0,0 @@
|
||||
<table class="table table-responsive" id="aircraftClasses-table">
|
||||
<thead>
|
||||
<th>Class</th>
|
||||
<th>Name</th>
|
||||
<th>Notes</th>
|
||||
<th colspan="3">Action</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($aircraftClasses as $aircraftClass)
|
||||
<tr>
|
||||
<td>{!! $aircraftClass->class !!}</td>
|
||||
<td>{!! $aircraftClass->name !!}</td>
|
||||
<td>{!! $aircraftClass->notes !!}</td>
|
||||
<td>
|
||||
{!! Form::open(['route' => ['admin.aircraftClasses.destroy', $aircraftClass->id], 'method' => 'delete']) !!}
|
||||
<div class='btn-group'>
|
||||
<a href="{!! route('admin.aircraftClasses.show', [$aircraftClass->id]) !!}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-eye-open"></i></a>
|
||||
<a href="{!! route('admin.aircraftClasses.edit', [$aircraftClass->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>
|
@ -2,9 +2,7 @@
|
||||
|
||||
@section('content')
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
Aircraft Classes
|
||||
</h1>
|
||||
<h1>Add Subfleet</h1>
|
||||
</section>
|
||||
<div class="content">
|
||||
@include('adminlte-templates::common.errors')
|
||||
@ -12,9 +10,9 @@
|
||||
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
{!! Form::open(['route' => 'admin.aircraftClasses.store']) !!}
|
||||
{!! Form::open(['route' => 'admin.subfleets.store']) !!}
|
||||
|
||||
@include('admin.aircraft_classes.fields')
|
||||
@include('admin.subfleets.fields')
|
||||
|
||||
{!! Form::close() !!}
|
||||
</div>
|
@ -2,22 +2,20 @@
|
||||
|
||||
@section('content')
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
Aircraft Class
|
||||
</h1>
|
||||
<h1>Edit {!! $subfleet->name !!}</h1>
|
||||
</section>
|
||||
<div class="content">
|
||||
@include('adminlte-templates::common.errors')
|
||||
<div class="box box-primary">
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
{!! Form::model($aircraftClass, ['route' => ['admin.aircraftClasses.update', $aircraftClass->id], 'method' => 'patch']) !!}
|
||||
{!! Form::model($subfleet, ['route' => ['admin.subfleets.update', $subfleet->id], 'method' => 'patch']) !!}
|
||||
|
||||
@include('admin.aircraft_classes.fields')
|
||||
@include('admin.subfleets.fields')
|
||||
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@endsection
|
23
resources/views/admin/subfleets/fields.blade.php
Normal file
23
resources/views/admin/subfleets/fields.blade.php
Normal file
@ -0,0 +1,23 @@
|
||||
<!-- Airline Id Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('airline_id', 'Airline Id:') !!}
|
||||
{!! Form::select('airline_id', $airlines, null , ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<!-- Name Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('name', 'Name:') !!}
|
||||
{!! Form::text('name', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<!-- Type Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('type', 'Type:') !!}
|
||||
{!! Form::text('type', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<!-- Submit Field -->
|
||||
<div class="form-group col-sm-12">
|
||||
{!! Form::submit('Save', ['class' => 'btn btn-primary']) !!}
|
||||
<a href="{!! route('admin.subfleets.index') !!}" class="btn btn-default">Cancel</a>
|
||||
</div>
|
@ -1,10 +1,10 @@
|
||||
@extends('layouts.app')
|
||||
@extends('admin.app')
|
||||
|
||||
@section('content')
|
||||
<section class="content-header">
|
||||
<h1 class="pull-left">Aircraft Classes</h1>
|
||||
<h1 class="pull-left">Subfleets</h1>
|
||||
<h1 class="pull-right">
|
||||
<a class="btn btn-primary pull-right" style="margin-top: -10px;margin-bottom: 5px" href="{!! route('admin.aircraftClasses.create') !!}">Add New</a>
|
||||
<a class="btn btn-primary pull-right" style="margin-top: -10px;margin-bottom: 5px" href="{!! route('admin.subfleets.create') !!}">Add New</a>
|
||||
</h1>
|
||||
</section>
|
||||
<div class="content">
|
||||
@ -15,7 +15,7 @@
|
||||
<div class="clearfix"></div>
|
||||
<div class="box box-primary">
|
||||
<div class="box-body">
|
||||
@include('admin.aircraft_classes.table')
|
||||
@include('admin.subfleets.table')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -1,17 +1,15 @@
|
||||
@extends('layouts.app')
|
||||
@extends('admin.app')
|
||||
|
||||
@section('content')
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
Aircraft Class
|
||||
</h1>
|
||||
<h1>{!! $subfleet->name !!}</h1>
|
||||
</section>
|
||||
<div class="content">
|
||||
<div class="box box-primary">
|
||||
<div class="box-body">
|
||||
<div class="row" style="padding-left: 20px">
|
||||
@include('admin.aircraft_classes.show_fields')
|
||||
<a href="{!! route('admin.aircraftClasses.index') !!}" class="btn btn-default">Back</a>
|
||||
@include('admin.subfleets.show_fields')
|
||||
<a href="{!! route('admin.subfleets.index') !!}" class="btn btn-default">Back</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
31
resources/views/admin/subfleets/show_fields.blade.php
Normal file
31
resources/views/admin/subfleets/show_fields.blade.php
Normal file
@ -0,0 +1,31 @@
|
||||
<!-- Id Field -->
|
||||
<!-- Airline Id Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('airline_id', 'Airline Id:') !!}
|
||||
<p>{!! $subfleet->airline->name !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- Name Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('name', 'Name:') !!}
|
||||
<p>{!! $subfleet->name !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- Type Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('type', 'Type:') !!}
|
||||
<p>{!! $subfleet->type !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- Created At Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('created_at', 'Created At:') !!}
|
||||
<p>{!! $subfleet->created_at !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- Updated At Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('updated_at', 'Updated At:') !!}
|
||||
<p>{!! $subfleet->updated_at !!}</p>
|
||||
</div>
|
||||
|
26
resources/views/admin/subfleets/table.blade.php
Normal file
26
resources/views/admin/subfleets/table.blade.php
Normal file
@ -0,0 +1,26 @@
|
||||
<table class="table table-responsive" id="subfleets-table">
|
||||
<thead>
|
||||
<th>Airline</th>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th colspan="3">Action</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($subfleets as $subfleet)
|
||||
<tr>
|
||||
<td>{!! $subfleet->airline->name !!}</td>
|
||||
<td>{!! $subfleet->name !!}</td>
|
||||
<td>{!! $subfleet->type !!}</td>
|
||||
<td>
|
||||
{!! Form::open(['route' => ['admin.subfleets.destroy', $subfleet->id], 'method' => 'delete']) !!}
|
||||
<div class='btn-group'>
|
||||
<a href="{!! route('admin.subfleets.show', [$subfleet->id]) !!}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-eye-open"></i></a>
|
||||
<a href="{!! route('admin.subfleets.edit', [$subfleet->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>
|
@ -12,6 +12,9 @@ Route::group([
|
||||
Route::resource('aircraftclasses', 'AircraftClassController');
|
||||
Route::resource('fares', 'FareController');
|
||||
|
||||
# subfleet
|
||||
Route::resource('subfleets', 'SubfleetController');
|
||||
|
||||
# aircraft and fare associations
|
||||
Route::resource('aircraft', 'AircraftController');
|
||||
Route::match(['get', 'post', 'put', 'delete'], 'aircraft/{id}/fares', 'AircraftController@fares');
|
||||
|
Loading…
Reference in New Issue
Block a user