From bf910e454959c07a818f7b1ab38b70d4c1cd0053 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Sat, 10 Jun 2017 18:27:19 -0500 Subject: [PATCH] set fare classes on aircraft w/ overrides (no admin ui yet) --- app/Http/Controllers/FareController.php | 146 +++++++++++++++++ app/Http/Requests/CreateFareRequest.php | 30 ++++ app/Http/Requests/UpdateFareRequest.php | 30 ++++ app/Models/Aircraft.php | 59 ++++--- app/Models/Fare.php | 66 ++++++++ app/Providers/AppServiceProvider.php | 11 +- app/Repositories/AircraftClassRepository.php | 1 - app/Repositories/AircraftRepository.php | 21 ++- app/Repositories/AirlinesRepository.php | 1 - app/Repositories/BaseRepository.php | 21 +++ app/Repositories/FareRepository.php | 32 ++++ app/Services/AircraftFareService.php | 30 ---- app/Services/AircraftService.php | 31 ++++ app/Services/BaseService.php | 7 + app/Services/FareService.php | 70 ++++++++ app/Services/PIREPService.php | 2 +- database/factories/FaresFactory.php | 5 +- ...17_06_09_010621_create_aircrafts_table.php | 2 +- .../2017_06_10_040335_create_fares_table.php | 51 ++++++ resources/views/admin/fares/create.blade.php | 24 +++ resources/views/admin/fares/edit.blade.php | 23 +++ resources/views/admin/fares/fields.blade.php | 7 + resources/views/admin/fares/index.blade.php | 23 +++ resources/views/admin/fares/show.blade.php | 19 +++ .../views/admin/fares/show_fields.blade.php | 54 +++++++ resources/views/admin/fares/table.blade.php | 32 ++++ tests/AircraftTest.php | 149 +++++++++++++++--- 27 files changed, 859 insertions(+), 88 deletions(-) create mode 100644 app/Http/Controllers/FareController.php create mode 100644 app/Http/Requests/CreateFareRequest.php create mode 100644 app/Http/Requests/UpdateFareRequest.php create mode 100644 app/Models/Fare.php create mode 100644 app/Repositories/BaseRepository.php create mode 100644 app/Repositories/FareRepository.php delete mode 100644 app/Services/AircraftFareService.php create mode 100644 app/Services/AircraftService.php create mode 100644 app/Services/BaseService.php create mode 100644 app/Services/FareService.php create mode 100644 database/migrations/2017_06_10_040335_create_fares_table.php create mode 100644 resources/views/admin/fares/create.blade.php create mode 100644 resources/views/admin/fares/edit.blade.php create mode 100644 resources/views/admin/fares/fields.blade.php create mode 100644 resources/views/admin/fares/index.blade.php create mode 100644 resources/views/admin/fares/show.blade.php create mode 100644 resources/views/admin/fares/show_fields.blade.php create mode 100644 resources/views/admin/fares/table.blade.php diff --git a/app/Http/Controllers/FareController.php b/app/Http/Controllers/FareController.php new file mode 100644 index 00000000..2bed7932 --- /dev/null +++ b/app/Http/Controllers/FareController.php @@ -0,0 +1,146 @@ +fareRepository = $fareRepo; + } + + /** + * Display a listing of the Fare. + * + * @param Request $request + * + * @return Response + */ + public function index(Request $request) + { + $this->fareRepository->pushCriteria(new RequestCriteria($request)); + $fares = $this->fareRepository->all(); + + return view('admin.fares.index') + ->with('fares', $fares); + } + + /** + * Show the form for creating a new Fare. + * + * @return Response + */ + public function create() + { + return view('admin.fares.create'); + } + + /** + * Store a newly created Fare in storage. + * + * @param CreateFareRequest $request + * + * @return Response + */ + public function store(CreateFareRequest $request) + { + $input = $request->all(); + $fare = $this->fareRepository->create($input); + Flash::success('Fare saved successfully.'); + + return redirect(route('admin.fares.index')); + } + + /** + * Display the specified Fare. + * + * @param int $id + * + * @return Response + */ + public function show($id) + { + $fare = $this->fareRepository->findWithoutFail($id); + if (empty($fare)) { + Flash::error('Fare not found'); + + return redirect(route('admin.fares.index')); + } + + return view('admin.fares.show')->with('fare', $fare); + } + + /** + * Show the form for editing the specified Fare. + * + * @param int $id + * + * @return Response + */ + public function edit($id) + { + $fare = $this->fareRepository->findWithoutFail($id); + if (empty($fare)) { + Flash::error('Fare not found'); + + return redirect(route('admin.fares.index')); + } + + return view('admin.fares.edit')->with('fare', $fare); + } + + /** + * Update the specified Fare in storage. + * + * @param int $id + * @param UpdateFareRequest $request + * + * @return Response + */ + public function update($id, UpdateFareRequest $request) + { + $fare = $this->fareRepository->findWithoutFail($id); + if (empty($fare)) { + Flash::error('Fare not found'); + + return redirect(route('admin.fares.index')); + } + $fare = $this->fareRepository->update($request->all(), $id); + Flash::success('Fare updated successfully.'); + + return redirect(route('admin.fares.index')); + } + + /** + * Remove the specified Fare from storage. + * + * @param int $id + * + * @return Response + */ + public function destroy($id) + { + $fare = $this->fareRepository->findWithoutFail($id); + if (empty($fare)) { + Flash::error('Fare not found'); + + return redirect(route('admin.fares.index')); + } + $this->fareRepository->delete($id); + Flash::success('Fare deleted successfully.'); + + return redirect(route('admin.fares.index')); + } +} diff --git a/app/Http/Requests/CreateFareRequest.php b/app/Http/Requests/CreateFareRequest.php new file mode 100644 index 00000000..107c8cfb --- /dev/null +++ b/app/Http/Requests/CreateFareRequest.php @@ -0,0 +1,30 @@ + 'string', - 'name' => 'string', - 'full_name' => 'string', - 'registration' => 'string', - 'active' => 'boolean', - ]; + protected $casts + = [ + 'icao' => 'string', + 'name' => 'string', + 'full_name' => 'string', + 'registration' => 'string', + 'active' => 'boolean', + ]; /** * Validation rules * * @var array */ - public static $rules = [ - 'icao' => 'required|max:4', - 'name' => 'required', - 'full_name' => 'required', - 'registration' => 'required', - 'active' => 'default:1' - ]; + public static $rules + = [ + 'icao' => 'required|max:4', + 'name' => 'required', + 'full_name' => 'required', + 'registration' => 'required', + 'active' => 'default:1', + ]; /** * foreign key @@ -63,8 +68,12 @@ class Aircraft extends Model ); } - public function fares() { - # aircraft_fare == table name - return $this->belongsToMany('App\Models\Fare', 'aircraft_fare'); + public function fares() + { + $r = $this->belongsToMany( + 'App\Models\Fare', + 'aircraft_fare' + )->withPivot('price', 'cost', 'capacity'); + return $r; } } diff --git a/app/Models/Fare.php b/app/Models/Fare.php new file mode 100644 index 00000000..2526887f --- /dev/null +++ b/app/Models/Fare.php @@ -0,0 +1,66 @@ + 'string', + 'name' => 'string', + 'price' => 'float', + 'cost' => 'float', + 'notes' => 'string', + 'active' => 'boolean', + ]; + + /** + * Validation rules + * + * @var array + */ + public static $rules + = [ + 'code' => 'required', + 'name' => 'required', + 'cost' => 'default:0.0', + ]; + + public function aircraft() { + return $this->belongsToMany( + 'App\Models\Aircraft', + 'aircraft_fare' + )->withPivot('price', 'cost', 'capacity'); + } + +} diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 35471f6f..c4379642 100755 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -4,6 +4,8 @@ namespace App\Providers; use Illuminate\Support\ServiceProvider; +use App\Services\AircraftService; + class AppServiceProvider extends ServiceProvider { /** @@ -23,6 +25,13 @@ class AppServiceProvider extends ServiceProvider */ public function register() { - // + // bind all the app services... + $this->app->bind('App\Services\AircraftService', function($app) { + return new \App\Services\AircraftService(); + }); + + $this->app->bind('App\Services\AircraftFareService', function($app) { + return new \App\Services\AircraftFareService(); + }); } } diff --git a/app/Repositories/AircraftClassRepository.php b/app/Repositories/AircraftClassRepository.php index dbd104bc..631596a6 100644 --- a/app/Repositories/AircraftClassRepository.php +++ b/app/Repositories/AircraftClassRepository.php @@ -3,7 +3,6 @@ namespace App\Repositories; use App\Models\AircraftClass; -use InfyOm\Generator\Common\BaseRepository; class AircraftClassRepository extends BaseRepository { diff --git a/app/Repositories/AircraftRepository.php b/app/Repositories/AircraftRepository.php index 468e23c8..e5218fbc 100644 --- a/app/Repositories/AircraftRepository.php +++ b/app/Repositories/AircraftRepository.php @@ -3,20 +3,20 @@ namespace App\Repositories; use App\Models\Aircraft; -use InfyOm\Generator\Common\BaseRepository; class AircraftRepository extends BaseRepository { /** * @var array */ - protected $fieldSearchable = [ - 'icao', - 'name', - 'full_name', - 'registration', - 'active', - ]; + protected $fieldSearchable + = [ + 'icao', + 'name', + 'full_name', + 'registration', + 'active', + ]; /** * Configure the Model @@ -25,4 +25,9 @@ class AircraftRepository extends BaseRepository { return Aircraft::class; } + + public function findByICAO($icao) + { + return $this->findByField('icao', $icao)->first(); + } } diff --git a/app/Repositories/AirlinesRepository.php b/app/Repositories/AirlinesRepository.php index 5f7488e0..103d6f11 100644 --- a/app/Repositories/AirlinesRepository.php +++ b/app/Repositories/AirlinesRepository.php @@ -3,7 +3,6 @@ namespace App\Repositories; use App\Models\Airlines; -use InfyOm\Generator\Common\BaseRepository; class AirlinesRepository extends BaseRepository { diff --git a/app/Repositories/BaseRepository.php b/app/Repositories/BaseRepository.php new file mode 100644 index 00000000..258fb593 --- /dev/null +++ b/app/Repositories/BaseRepository.php @@ -0,0 +1,21 @@ +model()->rules + ); + + if($validator->fails()) { + return $validator->messages(); + } + + return true; + } +} diff --git a/app/Repositories/FareRepository.php b/app/Repositories/FareRepository.php new file mode 100644 index 00000000..88a96a43 --- /dev/null +++ b/app/Repositories/FareRepository.php @@ -0,0 +1,32 @@ +findByField('code', $code)->first(); + } +} diff --git a/app/Services/AircraftFareService.php b/app/Services/AircraftFareService.php deleted file mode 100644 index aa1582fb..00000000 --- a/app/Services/AircraftFareService.php +++ /dev/null @@ -1,30 +0,0 @@ -fare = $fare; - $this->aircraft = $aircraft; - } - - public function link(int $aircraft_id, int $fare_id) { - - } - - public function unlink(int $aircraft_id, int $fare_id) { - - } -} diff --git a/app/Services/AircraftService.php b/app/Services/AircraftService.php new file mode 100644 index 00000000..74bc25ff --- /dev/null +++ b/app/Services/AircraftService.php @@ -0,0 +1,31 @@ +create($attributes); + } catch (Exception $e) { + return false; + } + + if ($class != null) { + $model->class()->associate($class); + $model->save(); + } + + return $model; + } +} diff --git a/app/Services/BaseService.php b/app/Services/BaseService.php new file mode 100644 index 00000000..3c80d020 --- /dev/null +++ b/app/Services/BaseService.php @@ -0,0 +1,7 @@ +fares()->syncWithoutDetaching([$fare->id]); + + # modify any pivot values? + if(count($override) > 0) { + $aircraft->fares()->updateExistingPivot($fare->id, $override); + } + + $aircraft->save(); + $aircraft = $aircraft->fresh(); + return $aircraft; + } + + /** + * return all the fares for an aircraft. check the pivot + * table to see if the price/cost/capacity has been overridden + * and return the correct amounts. + * @param Aircraft $aircraft + * @return Fare[] + */ + public function get_for_aircraft(Aircraft &$aircraft) + { + $fares = []; + foreach($aircraft->fares as $fare) { + if(!is_null($fare->pivot->price)) { + $fare->price = $fare->pivot->price; + } + + if(!is_null($fare->pivot->cost)) { + $fare->cost = $fare->pivot->cost; + } + + if(!is_null($fare->pivot->capacity)) { + $fare->capacity = $fare->pivot->capacity; + } + array_push($fares, $fare); + } + + return $fares; + } + + public function delete_from_aircraft(Aircraft &$aircraft, Fare &$fare) + { + $aircraft->fares()->detach($fare->id); + $aircraft = $aircraft->fresh(); + return $aircraft; + } +} diff --git a/app/Services/PIREPService.php b/app/Services/PIREPService.php index 79fdef3a..540e2a11 100644 --- a/app/Services/PIREPService.php +++ b/app/Services/PIREPService.php @@ -5,7 +5,7 @@ namespace App\Services; use App\Repositories\AircraftRepository; -class PIREPService { +class PIREPService extends BaseService { protected $aircraft; diff --git a/database/factories/FaresFactory.php b/database/factories/FaresFactory.php index 4ced6e91..c35fb54f 100644 --- a/database/factories/FaresFactory.php +++ b/database/factories/FaresFactory.php @@ -2,6 +2,9 @@ $factory->define(App\Models\Fare::class, function (Faker\Generator $faker) { return [ - + 'code' => 'Y', + 'name' => 'Economy', + 'price' => '100', + 'capacity' => '200', ]; }); diff --git a/database/migrations/2017_06_09_010621_create_aircrafts_table.php b/database/migrations/2017_06_09_010621_create_aircrafts_table.php index bd0496e8..3825d777 100644 --- a/database/migrations/2017_06_09_010621_create_aircrafts_table.php +++ b/database/migrations/2017_06_09_010621_create_aircrafts_table.php @@ -9,7 +9,7 @@ class CreateAircraftsTable extends Migration { Schema::create('aircraft', function (Blueprint $table) { $table->increments('id'); - $table->integer('aircraft_class_id')->unsigned(); + $table->integer('aircraft_class_id')->unsigned()->nullable(); $table->string('icao'); $table->string('name'); $table->string('full_name')->nullable(); diff --git a/database/migrations/2017_06_10_040335_create_fares_table.php b/database/migrations/2017_06_10_040335_create_fares_table.php new file mode 100644 index 00000000..ba5a4500 --- /dev/null +++ b/database/migrations/2017_06_10_040335_create_fares_table.php @@ -0,0 +1,51 @@ +increments('id'); + $table->string('code'); + $table->string('name'); + $table->float('price'); + $table->float('cost')->default(0.0); + $table->integer('capacity')->default(0); + $table->string('notes')->nullable(); + $table->boolean('active')->default(true); + $table->timestamps(); + $table->softDeletes(); + }); + + Schema::create('aircraft_fare', function (Blueprint $table) { + $table->increments('id'); + $table->integer('aircraft_id'); + $table->integer('fare_id'); + $table->float('price')->nullable(); + $table->float('cost')->nullable(); + $table->float('capacity')->nullable(); + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('fares'); + Schema::drop('aircraft_fare'); + } +} diff --git a/resources/views/admin/fares/create.blade.php b/resources/views/admin/fares/create.blade.php new file mode 100644 index 00000000..43145702 --- /dev/null +++ b/resources/views/admin/fares/create.blade.php @@ -0,0 +1,24 @@ +@extends('admin.app') + +@section('content') +
+

+ Fare +

+
+
+ @include('adminlte-templates::common.errors') +
+ +
+
+ {!! Form::open(['route' => 'admin.fares.store']) !!} + + @include('admin.fares.fields') + + {!! Form::close() !!} +
+
+
+
+@endsection diff --git a/resources/views/admin/fares/edit.blade.php b/resources/views/admin/fares/edit.blade.php new file mode 100644 index 00000000..2def9841 --- /dev/null +++ b/resources/views/admin/fares/edit.blade.php @@ -0,0 +1,23 @@ +@extends('admin.app') + +@section('content') +
+

+ Fare +

+
+
+ @include('adminlte-templates::common.errors') +
+
+
+ {!! Form::model($fare, ['route' => ['admin.fares.update', $fare->id], 'method' => 'patch']) !!} + + @include('admin.fares.fields') + + {!! Form::close() !!} +
+
+
+
+@endsection diff --git a/resources/views/admin/fares/fields.blade.php b/resources/views/admin/fares/fields.blade.php new file mode 100644 index 00000000..8a9792d2 --- /dev/null +++ b/resources/views/admin/fares/fields.blade.php @@ -0,0 +1,7 @@ + + + +
+ {!! Form::submit('Save', ['class' => 'btn btn-primary']) !!} + Cancel +
diff --git a/resources/views/admin/fares/index.blade.php b/resources/views/admin/fares/index.blade.php new file mode 100644 index 00000000..608610fc --- /dev/null +++ b/resources/views/admin/fares/index.blade.php @@ -0,0 +1,23 @@ +@extends('admin.app') + +@section('content') +
+

Fares

+

+ Add New +

+
+
+
+ + @include('flash::message') + +
+
+
+ @include('admin.fares.table') +
+
+
+@endsection + diff --git a/resources/views/admin/fares/show.blade.php b/resources/views/admin/fares/show.blade.php new file mode 100644 index 00000000..e9e6da90 --- /dev/null +++ b/resources/views/admin/fares/show.blade.php @@ -0,0 +1,19 @@ +@extends('admin.app') + +@section('content') +
+

+ Fare +

+
+
+
+
+
+ @include('admin.fares.show_fields') + Back +
+
+
+
+@endsection diff --git a/resources/views/admin/fares/show_fields.blade.php b/resources/views/admin/fares/show_fields.blade.php new file mode 100644 index 00000000..825b1d95 --- /dev/null +++ b/resources/views/admin/fares/show_fields.blade.php @@ -0,0 +1,54 @@ + +
+ {!! Form::label('id', 'Id:') !!} +

{!! $fare->id !!}

+
+ + +
+ {!! Form::label('code', 'Code:') !!} +

{!! $fare->code !!}

+
+ + +
+ {!! Form::label('name', 'Name:') !!} +

{!! $fare->name !!}

+
+ + +
+ {!! Form::label('price', 'Price:') !!} +

{!! $fare->price !!}

+
+ + +
+ {!! Form::label('cost', 'Cost:') !!} +

{!! $fare->cost !!}

+
+ + +
+ {!! Form::label('notes', 'Notes:') !!} +

{!! $fare->notes !!}

+
+ + +
+ {!! Form::label('active', 'Active:') !!} +

{!! $fare->active !!}

+
+ + +
+ {!! Form::label('created_at', 'Created At:') !!} +

{!! $fare->created_at !!}

+
+ + +
+ {!! Form::label('updated_at', 'Updated At:') !!} +

{!! $fare->updated_at !!}

+
+ diff --git a/resources/views/admin/fares/table.blade.php b/resources/views/admin/fares/table.blade.php new file mode 100644 index 00000000..754462f0 --- /dev/null +++ b/resources/views/admin/fares/table.blade.php @@ -0,0 +1,32 @@ + + + + + + + + + + + + @foreach($fares as $fare) + + + + + + + + + + @endforeach + +
CodeNamePriceCostNotesActiveAction
{!! $fare->code !!}{!! $fare->name !!}{!! $fare->price !!}{!! $fare->cost !!}{!! $fare->notes !!}{!! $fare->active !!} + {!! Form::open(['route' => ['admin.fares.destroy', $fare->id], 'method' => 'delete']) !!} +
+ + + {!! Form::button('', ['type' => 'submit', 'class' => 'btn btn-danger btn-xs', 'onclick' => "return confirm('Are you sure?')"]) !!} +
+ {!! Form::close() !!} +
\ No newline at end of file diff --git a/tests/AircraftTest.php b/tests/AircraftTest.php index a1a9be28..e86ec44a 100644 --- a/tests/AircraftTest.php +++ b/tests/AircraftTest.php @@ -1,40 +1,151 @@ aircraft = $this->createRepository('AircraftRepository'); - $this->aircraft_class = $this->createRepository('AircraftClassRepository'); - - # add an aircraft_class - factory(App\Models\AircraftClass::class)->create(); + $this->setup_data(); } - protected function add_fares(Aircraft $aircraft) { + /** + * add the fares to a given aircraft + * run the factory for incl the fares + */ + protected function setup_data() + { + factory(App\Models\AircraftClass::class)->create(); + factory(App\Models\Fare::class)->create(); + } + protected function get_ac_class() + { + return app('App\Repositories\AircraftClassRepository') + ->findByField('code', 'H')->first(); + } + + protected function find_by_icao($icao) + { + $ac_repo = app('App\Repositories\AircraftRepository'); + return $ac_repo->findByICAO($icao); + } + + protected function get_fare_by_code($code) + { + return app('App\Repositories\FareRepository')->findByCode($code); + } + + /** + * Check the association of the aircraft class to an aircraft + * Mostly to experiment with the ORM type stuff. This isn't + * where most of the testing, etc is required. + */ + protected function add_aircraft() + { + $svc = app('App\Services\AircraftService'); + $err = $svc->create([ + 'icao' => $this->ICAO, + 'name' => 'Boeing 777', + ], $this->get_ac_class()); + + $this->assertNotFalse($err); + + return $this->find_by_icao($this->ICAO); } public function testAircraftClasses() { - # add a few fare classes + $aircraft = $this->add_aircraft(); + $this->assertEquals($this->ICAO, $aircraft->icao, 'ICAO matching'); + $this->assertEquals( + $this->get_ac_class(), + $aircraft->class, + 'Check belongsTo relationship' + ); + } - $this->aircraft->create([ - 'aircraft_class_id' => 1, - 'icao' => 'B777', - 'name' => 'Boeing 777', + public function testAircraftFaresNoOverride() + { + $fare_svc = app('App\Services\FareService'); + + $aircraft = $this->add_aircraft(); + $fare = $this->get_fare_by_code('Y'); + + $fare_svc->set_for_aircraft($aircraft, $fare); + $ac_fares = $fare_svc->get_for_aircraft($aircraft); + + $this->assertCount(1, $ac_fares); + $this->assertEquals($fare->price, $ac_fares[0]->price); + $this->assertEquals($fare->capacity, $ac_fares[0]->capacity); + + # + # set an override now + # + $fare_svc->set_for_aircraft($aircraft, $fare, [ + 'price' => 50, 'capacity' => 400 ]); - $aircraft = Aircraft::where('icao', 'B777')->first(); - $this->assertEquals('B777', $aircraft->icao, 'ICAO matching'); - $this->assertEquals('H', $aircraft->class->code, 'Check belongsTo relationship'); + # look for them again + $ac_fares = $fare_svc->get_for_aircraft($aircraft); - // check to see if the fares are properly applied to this aircraft - $this->add_fares($aircraft); + $this->assertCount(1, $ac_fares); + $this->assertEquals(50, $ac_fares[0]->price); + $this->assertEquals(400, $ac_fares[0]->capacity); + + # delete + $fare_svc->delete_from_aircraft($aircraft, $fare); + $this->assertCount(0, $fare_svc->get_for_aircraft($aircraft)); + } + + public function testAircraftFaresOverride() + { + $fare_svc = app('App\Services\FareService'); + + $aircraft = $this->add_aircraft(); + $fare = $this->get_fare_by_code('Y'); + + $fare_svc->set_for_aircraft($aircraft, $fare, [ + 'price' => 50, 'capacity' => 400 + ]); + + $ac_fares = $fare_svc->get_for_aircraft($aircraft); + + $this->assertCount(1, $ac_fares); + $this->assertEquals(50, $ac_fares[0]->price); + $this->assertEquals(400, $ac_fares[0]->capacity); + + # + # update the override to a different amount and make sure it updates + # + + $fare_svc->set_for_aircraft($aircraft, $fare, [ + 'price' => 150, 'capacity' => 50 + ]); + + $ac_fares = $fare_svc->get_for_aircraft($aircraft); + + $this->assertCount(1, $ac_fares); + $this->assertEquals(150, $ac_fares[0]->price); + $this->assertEquals(50, $ac_fares[0]->capacity); + + # delete + $fare_svc->delete_from_aircraft($aircraft, $fare); + $this->assertCount(0, $fare_svc->get_for_aircraft($aircraft)); + } + + /** + * @expectedException Exception + */ + public function testAircraftMissingField() + { + # missing the name field + $svc = app('App\Services\AircraftService'); + $svc->create(['icao' => $this->ICAO]); } }