add/set ICAO and logo for airlines
This commit is contained in:
parent
123ac5dcca
commit
beba08f651
@ -15,9 +15,11 @@ class Airline extends Model
|
||||
protected $dates = ['deleted_at'];
|
||||
|
||||
public $fillable = [
|
||||
'code',
|
||||
'icao',
|
||||
'iata',
|
||||
'name',
|
||||
'logo',
|
||||
'country',
|
||||
'fuel_100ll_cost',
|
||||
'fuel_jeta_cost',
|
||||
'fuel_mogas_cost',
|
||||
@ -30,8 +32,6 @@ class Airline extends Model
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'code' => 'string',
|
||||
'name' => 'string',
|
||||
'fuel_100ll_cost' => 'double',
|
||||
'fuel_jeta_cost' => 'double',
|
||||
'fuel_mogas_cost' => 'double',
|
||||
@ -48,4 +48,11 @@ class Airline extends Model
|
||||
'name' => 'required',
|
||||
];
|
||||
|
||||
/**
|
||||
* For backwards compatibility
|
||||
*/
|
||||
public function getCodeAttribute() {
|
||||
return $this->icao;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ class User extends Authenticatable
|
||||
|
||||
public function pilot_id()
|
||||
{
|
||||
return $this->airline->code.str_pad($this->id, 3, '0', STR_PAD_LEFT);
|
||||
return $this->airline->icao.str_pad($this->id, 3, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
public function gravatar()
|
||||
|
@ -15,10 +15,11 @@ class CreateAirlinesTable extends Migration
|
||||
{
|
||||
Schema::create('airlines', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('code', 5);
|
||||
$table->string('icao', 5);
|
||||
$table->string('iata', 3)->nullable();
|
||||
$table->string('name', 50);
|
||||
$table->string('country', 2)->nullable();
|
||||
$table->string('logo', 255)->nullable();
|
||||
$table->boolean('active');
|
||||
$table->timestamps();
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!-- Code Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('code', 'Code:') !!}
|
||||
{!! Form::text('code', null, ['class' => 'form-control']) !!}
|
||||
{!! Form::label('icao', 'Code:') !!}
|
||||
{!! Form::text('icao', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-6">
|
||||
@ -15,6 +15,11 @@
|
||||
{!! Form::text('name', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('logo', 'Logo URL:') !!}
|
||||
{!! Form::text('logo', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<!-- Active Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('active', 'Active:') !!}
|
||||
|
@ -1,13 +1,7 @@
|
||||
<!-- Id Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('id', 'Id:') !!}
|
||||
<p>{!! $airlines->id !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- Code Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('code', 'Code:') !!}
|
||||
<p>{!! $airlines->code !!}</p>
|
||||
{!! Form::label('icao', 'ICAO:') !!}
|
||||
<p>{!! $airlines->icao !!}</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@ -21,6 +15,11 @@
|
||||
<p>{!! $airlines->name !!}</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{!! Form::label('logo', 'Logo URL:') !!}
|
||||
<p>{!! $airlines->logo !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- Active Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('active', 'Active:') !!}
|
||||
|
Loading…
Reference in New Issue
Block a user