Remove tail_number field from aircraft

This commit is contained in:
Nabeel Shahzad 2018-02-12 11:03:25 -06:00
parent 62506a26a1
commit ee71f4a1c8
7 changed files with 23 additions and 41 deletions

View File

@ -14,7 +14,6 @@ $factory->define(App\Models\Aircraft::class, function (Faker $faker) {
'icao' => $faker->unique()->text(5), 'icao' => $faker->unique()->text(5),
'name' => $faker->unique()->text(50), 'name' => $faker->unique()->text(50),
'registration' => $faker->unique()->text(10), 'registration' => $faker->unique()->text(10),
'tail_number' => $faker->unique()->text(10),
'active' => true, 'active' => true,
'created_at' => $faker->dateTimeBetween('-1 week', 'now'), 'created_at' => $faker->dateTimeBetween('-1 week', 'now'),
'updated_at' => function (array $pirep) { 'updated_at' => function (array $pirep) {

View File

@ -15,10 +15,9 @@ class CreateAircraftsTable extends Migration
$table->string('icao', 4)->nullable(); $table->string('icao', 4)->nullable();
$table->string('airport_id', 5)->nullable(); $table->string('airport_id', 5)->nullable();
$table->timestamp('landing_time')->nullable(); $table->timestamp('landing_time')->nullable();
$table->string('hex_code', 10)->nullable();
$table->string('name', 50); $table->string('name', 50);
$table->string('registration', 10)->nullable(); $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->unsignedDecimal('zfw', 12)->nullable()->default(0);
$table->unsignedBigInteger('flight_time')->nullable()->default(0); $table->unsignedBigInteger('flight_time')->nullable()->default(0);
$table->boolean('active')->default(true); $table->boolean('active')->default(true);

View File

@ -4,6 +4,7 @@ airlines:
icao: VMS icao: VMS
iata: VM iata: VM
name: phpvms airlines name: phpvms airlines
country: us
active: 1 active: 1
created_at: now created_at: now
updated_at: now updated_at: now
@ -183,18 +184,15 @@ aircraft:
- id: 1 - id: 1
subfleet_id: 1 subfleet_id: 1
name: Boeing 747-400 name: Boeing 747-400
registration: NC17 registration: 001Z
tail_number: 17
- id: 2 - id: 2
subfleet_id: 2 subfleet_id: 2
name: Boeing 777-200 name: Boeing 777-200
registration: NC20 registration: C202
tail_number: 20
- id: 3 - id: 3
subfleet_id: 1 subfleet_id: 1
name: Boeing 747-412 name: Boeing 747-412
registration: NS233 registration: S2333
tail_number: 1233
fares: fares:
- id: 1 - id: 1

View File

@ -12,7 +12,6 @@ class Aircraft extends BaseModel
'name', 'name',
'icao', 'icao',
'registration', 'registration',
'tail_number',
'zfw', 'zfw',
'active', 'active',
]; ];

View File

@ -1,55 +1,47 @@
<div class="row"> <div class="row">
<!-- Name Field -->
<div class="form-group col-sm-6">
{!! Form::label('name', 'Name:') !!}&nbsp;<span class="required">*</span>
{!! Form::text('name', null, ['class' => 'form-control']) !!}
<p class="text-danger">{{ $errors->first('name') }}</p>
</div>
<div class="form-group col-sm-6"> <div class="form-group col-sm-6">
{!! Form::label('subfleet_id', 'Subfleet:') !!} {!! Form::label('subfleet_id', 'Subfleet:') !!}
{!! Form::select('subfleet_id', $subfleets, null, ['class' => 'form-control select2', 'placeholder' => 'Select Subfleet']) !!} {!! Form::select('subfleet_id', $subfleets, null, ['class' => 'form-control select2', 'placeholder' => 'Select Subfleet']) !!}
<p class="text-danger">{{ $errors->first('subfleet_id') }}</p> <p class="text-danger">{{ $errors->first('subfleet_id') }}</p>
</div> </div>
<div class="form-group col-sm-6">
{!! Form::label('name', 'Name:') !!}&nbsp;<span class="required">*</span>
{!! Form::text('name', null, ['class' => 'form-control']) !!}
<p class="text-danger">{{ $errors->first('name') }}</p>
</div>
</div> </div>
<div class="row"> <div class="row">
<div class="form-group col-sm-3"> <div class="form-group col-sm-6">
{!! Form::label('icao', 'ICAO:') !!} {!! Form::label('icao', 'ICAO:') !!}
{!! Form::text('icao', null, ['class' => 'form-control']) !!} {!! Form::text('icao', null, ['class' => 'form-control']) !!}
<p class="text-danger">{{ $errors->first('icao') }}</p> <p class="text-danger">{{ $errors->first('icao') }}</p>
</div> </div>
<!-- Registration Field --> <div class="form-group col-sm-6">
<div class="form-group col-sm-3">
{!! Form::label('registration', 'Registration:') !!}
{!! Form::text('registration', null, ['class' => 'form-control']) !!}
<p class="text-danger">{{ $errors->first('registration') }}</p>
</div>
<!-- Tail Number Field -->
<div class="form-group col-sm-3">
{!! Form::label('tail_number', 'Tail Number:') !!}
{!! Form::text('tail_number', null, ['class' => 'form-control']) !!}
<p class="text-danger">{{ $errors->first('tail_number') }}</p>
</div>
<div class="form-group col-sm-3">
{!! Form::label('zfw', 'Zero Fuel Weight:') !!} {!! Form::label('zfw', 'Zero Fuel Weight:') !!}
{!! Form::text('zfw', null, ['class' => 'form-control']) !!} {!! Form::text('zfw', null, ['class' => 'form-control']) !!}
<p class="text-danger">{{ $errors->first('zfw') }}</p> <p class="text-danger">{{ $errors->first('zfw') }}</p>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<!-- Registration Field -->
<div class="form-group col-sm-6">
{!! Form::label('registration', 'Registration:') !!}
<p class="text-success small">Enter the registration without the country prefix</p>
{!! Form::text('registration', null, ['class' => 'form-control']) !!}
<p class="text-danger">{{ $errors->first('registration') }}</p>
</div>
<!-- Active Field --> <!-- Active Field -->
<div class="form-group col-6"> <div class="form-group col-6">
{!! Form::label('active', 'Active:') !!} {!! Form::label('active', 'Active:') !!}
<br />
<label class="checkbox-inline"> <label class="checkbox-inline">
{!! Form::hidden('active', 0, false) !!} {!! Form::hidden('active', 0, false) !!}
{!! Form::checkbox('active', 1, null) !!} {!! Form::checkbox('active', 1, null) !!}
</label> </label>
</div> </div>
<div class="col-6">&nbsp;</div>
</div> </div>
<div class="row"> <div class="row">
<!-- Submit Field --> <!-- Submit Field -->

View File

@ -29,10 +29,9 @@
<div class="box box-solid"> <div class="box box-solid">
<div class="box-header with-border"> <div class="box-header with-border">
{{--<i class="fa fa-text-width"></i>--}} {{--<i class="fa fa-text-width"></i>--}}
<h3 class="box-title">{!! Form::label('registration', 'Registration') !!}/ <h3 class="box-title">{!! Form::label('registration', 'Registration') !!}</h3>
{!! Form::label('tail_number', 'Tail Number') !!}</h3>
</div> </div>
<div class="box-body"><p class="lead">{!! $aircraft->registration !!}/{!! $aircraft->tail_number !!}</p></div> <div class="box-body"><p class="lead">{!! $aircraft->registration !!}</p></div>
</div> </div>
</div> </div>

View File

@ -204,10 +204,6 @@ class ApiTest extends TestCase
$body = $resp->json()['data']; $body = $resp->json()['data'];
$this->assertEquals($body['id'], $aircraft->id); $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); $resp = $this->get('/api/fleet/aircraft/' . $aircraft->id . '?icao=' . $aircraft->icao);
$body = $resp->json()['data']; $body = $resp->json()['data'];
$this->assertEquals($body['id'], $aircraft->id); $this->assertEquals($body['id'], $aircraft->id);