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),
'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) {

View File

@ -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);

View File

@ -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

View File

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

View File

@ -1,55 +1,47 @@
<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">
{!! Form::label('subfleet_id', 'Subfleet:') !!}
{!! Form::select('subfleet_id', $subfleets, null, ['class' => 'form-control select2', 'placeholder' => 'Select Subfleet']) !!}
<p class="text-danger">{{ $errors->first('subfleet_id') }}</p>
</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 class="row">
<div class="form-group col-sm-3">
<div class="form-group col-sm-6">
{!! Form::label('icao', 'ICAO:') !!}
{!! Form::text('icao', null, ['class' => 'form-control']) !!}
<p class="text-danger">{{ $errors->first('icao') }}</p>
</div>
<!-- Registration Field -->
<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">
<div class="form-group col-sm-6">
{!! Form::label('zfw', 'Zero Fuel Weight:') !!}
{!! Form::text('zfw', null, ['class' => 'form-control']) !!}
<p class="text-danger">{{ $errors->first('zfw') }}</p>
</div>
</div>
<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 -->
<div class="form-group col-6">
{!! Form::label('active', 'Active:') !!}
<br />
<label class="checkbox-inline">
{!! Form::hidden('active', 0, false) !!}
{!! Form::checkbox('active', 1, null) !!}
</label>
</div>
<div class="col-6">&nbsp;</div>
</div>
<div class="row">
<!-- Submit Field -->

View File

@ -29,10 +29,9 @@
<div class="box box-solid">
<div class="box-header with-border">
{{--<i class="fa fa-text-width"></i>--}}
<h3 class="box-title">{!! Form::label('registration', 'Registration') !!}/
{!! Form::label('tail_number', 'Tail Number') !!}</h3>
<h3 class="box-title">{!! Form::label('registration', 'Registration') !!}</h3>
</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>

View File

@ -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);