From ee71f4a1c8675a7c2169dd72a83dd86ee955f822 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Mon, 12 Feb 2018 11:03:25 -0600 Subject: [PATCH] Remove tail_number field from aircraft --- app/Database/factories/AircraftFactory.php | 1 - ...17_06_09_010621_create_aircrafts_table.php | 3 +- app/Database/seeds/sample.yml | 10 ++--- app/Models/Aircraft.php | 1 - .../views/admin/aircraft/fields.blade.php | 40 ++++++++----------- .../admin/aircraft/show_fields.blade.php | 5 +-- tests/ApiTest.php | 4 -- 7 files changed, 23 insertions(+), 41 deletions(-) diff --git a/app/Database/factories/AircraftFactory.php b/app/Database/factories/AircraftFactory.php index bcf501aa..6ef50057 100644 --- a/app/Database/factories/AircraftFactory.php +++ b/app/Database/factories/AircraftFactory.php @@ -14,7 +14,6 @@ $factory->define(App\Models\Aircraft::class, function (Faker $faker) { 'icao' => $faker->unique()->text(5), 'name' => $faker->unique()->text(50), 'registration' => $faker->unique()->text(10), - 'tail_number' => $faker->unique()->text(10), 'active' => true, 'created_at' => $faker->dateTimeBetween('-1 week', 'now'), 'updated_at' => function (array $pirep) { diff --git a/app/Database/migrations/2017_06_09_010621_create_aircrafts_table.php b/app/Database/migrations/2017_06_09_010621_create_aircrafts_table.php index 39f8c471..c7eb26c5 100644 --- a/app/Database/migrations/2017_06_09_010621_create_aircrafts_table.php +++ b/app/Database/migrations/2017_06_09_010621_create_aircrafts_table.php @@ -15,10 +15,9 @@ class CreateAircraftsTable extends Migration $table->string('icao', 4)->nullable(); $table->string('airport_id', 5)->nullable(); $table->timestamp('landing_time')->nullable(); - $table->string('hex_code', 10)->nullable(); $table->string('name', 50); $table->string('registration', 10)->nullable(); - $table->string('tail_number', 10)->nullable(); + $table->string('hex_code', 10)->nullable(); $table->unsignedDecimal('zfw', 12)->nullable()->default(0); $table->unsignedBigInteger('flight_time')->nullable()->default(0); $table->boolean('active')->default(true); diff --git a/app/Database/seeds/sample.yml b/app/Database/seeds/sample.yml index 5601aff0..5071245b 100644 --- a/app/Database/seeds/sample.yml +++ b/app/Database/seeds/sample.yml @@ -4,6 +4,7 @@ airlines: icao: VMS iata: VM name: phpvms airlines + country: us active: 1 created_at: now updated_at: now @@ -183,18 +184,15 @@ aircraft: - id: 1 subfleet_id: 1 name: Boeing 747-400 - registration: NC17 - tail_number: 17 + registration: 001Z - id: 2 subfleet_id: 2 name: Boeing 777-200 - registration: NC20 - tail_number: 20 + registration: C202 - id: 3 subfleet_id: 1 name: Boeing 747-412 - registration: NS233 - tail_number: 1233 + registration: S2333 fares: - id: 1 diff --git a/app/Models/Aircraft.php b/app/Models/Aircraft.php index c5fc999d..3ab0eb3a 100644 --- a/app/Models/Aircraft.php +++ b/app/Models/Aircraft.php @@ -12,7 +12,6 @@ class Aircraft extends BaseModel 'name', 'icao', 'registration', - 'tail_number', 'zfw', 'active', ]; diff --git a/resources/views/admin/aircraft/fields.blade.php b/resources/views/admin/aircraft/fields.blade.php index 075881d7..cafc24e9 100644 --- a/resources/views/admin/aircraft/fields.blade.php +++ b/resources/views/admin/aircraft/fields.blade.php @@ -1,55 +1,47 @@
- -
- {!! Form::label('name', 'Name:') !!} * - {!! Form::text('name', null, ['class' => 'form-control']) !!} -

{{ $errors->first('name') }}

-
-
{!! Form::label('subfleet_id', 'Subfleet:') !!} {!! Form::select('subfleet_id', $subfleets, null, ['class' => 'form-control select2', 'placeholder' => 'Select Subfleet']) !!}

{{ $errors->first('subfleet_id') }}

+
+ {!! Form::label('name', 'Name:') !!} * + {!! Form::text('name', null, ['class' => 'form-control']) !!} +

{{ $errors->first('name') }}

+
+
-
+
{!! Form::label('icao', 'ICAO:') !!} {!! Form::text('icao', null, ['class' => 'form-control']) !!}

{{ $errors->first('icao') }}

- -
- {!! Form::label('registration', 'Registration:') !!} - {!! Form::text('registration', null, ['class' => 'form-control']) !!} -

{{ $errors->first('registration') }}

-
- - -
- {!! Form::label('tail_number', 'Tail Number:') !!} - {!! Form::text('tail_number', null, ['class' => 'form-control']) !!} -

{{ $errors->first('tail_number') }}

-
- -
+
{!! Form::label('zfw', 'Zero Fuel Weight:') !!} {!! Form::text('zfw', null, ['class' => 'form-control']) !!}

{{ $errors->first('zfw') }}

+ +
+ {!! Form::label('registration', 'Registration:') !!} +

Enter the registration without the country prefix

+ {!! Form::text('registration', null, ['class' => 'form-control']) !!} +

{{ $errors->first('registration') }}

+
{!! Form::label('active', 'Active:') !!} +
-
 
diff --git a/resources/views/admin/aircraft/show_fields.blade.php b/resources/views/admin/aircraft/show_fields.blade.php index 421fd7b4..5227dba2 100644 --- a/resources/views/admin/aircraft/show_fields.blade.php +++ b/resources/views/admin/aircraft/show_fields.blade.php @@ -29,10 +29,9 @@
{{----}} -

{!! Form::label('registration', 'Registration') !!}/ - {!! Form::label('tail_number', 'Tail Number') !!}

+

{!! Form::label('registration', 'Registration') !!}

-

{!! $aircraft->registration !!}/{!! $aircraft->tail_number !!}

+

{!! $aircraft->registration !!}

diff --git a/tests/ApiTest.php b/tests/ApiTest.php index f40d1e69..7b66a7ed 100644 --- a/tests/ApiTest.php +++ b/tests/ApiTest.php @@ -204,10 +204,6 @@ class ApiTest extends TestCase $body = $resp->json()['data']; $this->assertEquals($body['id'], $aircraft->id); - $resp = $this->get('/api/fleet/aircraft/' . $aircraft->id . '?tail_number=' . $aircraft->registration); - $body = $resp->json()['data']; - $this->assertEquals($body['id'], $aircraft->id); - $resp = $this->get('/api/fleet/aircraft/' . $aircraft->id . '?icao=' . $aircraft->icao); $body = $resp->json()['data']; $this->assertEquals($body['id'], $aircraft->id);