2017-06-09 09:02:52 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
/**
|
2017-06-20 00:50:25 +08:00
|
|
|
* Class Airline
|
2017-06-09 09:02:52 +08:00
|
|
|
* @package App\Models
|
|
|
|
*/
|
2017-12-26 05:19:34 +08:00
|
|
|
class Airline extends BaseModel
|
2017-06-09 09:02:52 +08:00
|
|
|
{
|
|
|
|
public $table = 'airlines';
|
|
|
|
|
|
|
|
public $fillable = [
|
2017-08-16 21:11:39 +08:00
|
|
|
'icao',
|
2017-07-23 12:03:39 +08:00
|
|
|
'iata',
|
2017-06-09 09:02:52 +08:00
|
|
|
'name',
|
2017-08-16 21:11:39 +08:00
|
|
|
'logo',
|
|
|
|
'country',
|
2017-07-08 21:09:58 +08:00
|
|
|
'active',
|
2017-06-09 09:02:52 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The attributes that should be casted to native types.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $casts = [
|
2017-12-30 06:56:46 +08:00
|
|
|
'active' => 'boolean',
|
2017-06-09 09:02:52 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Validation rules
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
public static $rules = [
|
2017-12-31 04:37:10 +08:00
|
|
|
'iata' => 'required|max:5',
|
|
|
|
'icao' => 'required|max:5',
|
2017-07-08 21:09:58 +08:00
|
|
|
'name' => 'required',
|
2017-06-09 09:02:52 +08:00
|
|
|
];
|
|
|
|
|
2017-08-16 21:11:39 +08:00
|
|
|
/**
|
|
|
|
* For backwards compatibility
|
|
|
|
*/
|
|
|
|
public function getCodeAttribute() {
|
|
|
|
return $this->icao;
|
|
|
|
}
|
|
|
|
|
2017-06-09 09:02:52 +08:00
|
|
|
}
|