add/set ICAO and logo for airlines

This commit is contained in:
Nabeel Shahzad
2017-08-16 08:11:39 -05:00
parent 123ac5dcca
commit beba08f651
5 changed files with 27 additions and 15 deletions

View File

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

View File

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