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