diff --git a/app/Models/Airline.php b/app/Models/Airline.php index 8dc8a3e7..a9800022 100644 --- a/app/Models/Airline.php +++ b/app/Models/Airline.php @@ -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; + } + } diff --git a/app/Models/User.php b/app/Models/User.php index c322a448..8299210f 100755 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -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() diff --git a/database/migrations/2017_06_08_191703_create_airlines_table.php b/database/migrations/2017_06_08_191703_create_airlines_table.php index 79d840bc..edeaf2cb 100644 --- a/database/migrations/2017_06_08_191703_create_airlines_table.php +++ b/database/migrations/2017_06_08_191703_create_airlines_table.php @@ -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(); diff --git a/resources/views/admin/airlines/fields.blade.php b/resources/views/admin/airlines/fields.blade.php index 43f8ff7b..96507521 100644 --- a/resources/views/admin/airlines/fields.blade.php +++ b/resources/views/admin/airlines/fields.blade.php @@ -1,7 +1,7 @@
{!! $airlines->id !!}
-{!! $airlines->code !!}
+ {!! Form::label('icao', 'ICAO:') !!} +{!! $airlines->icao !!}
{!! $airlines->name !!}
{!! $airlines->logo !!}
+