2017-06-12 00:36:16 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
use Eloquent as Model;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class Airport
|
|
|
|
* @package App\Models
|
|
|
|
*/
|
|
|
|
class Airport extends Model
|
|
|
|
{
|
|
|
|
public $table = 'airports';
|
|
|
|
protected $dates = ['deleted_at'];
|
|
|
|
|
|
|
|
public $fillable = [
|
2017-07-06 07:48:32 +08:00
|
|
|
'icao',
|
|
|
|
'name',
|
|
|
|
'location',
|
2017-07-08 05:15:03 +08:00
|
|
|
'lat',
|
|
|
|
'lon',
|
2017-07-06 07:48:32 +08:00
|
|
|
'fuel_100ll_cost',
|
|
|
|
'fuel_jeta_cost',
|
|
|
|
'fuel_mogas_cost',
|
2017-06-12 00:36:16 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The attributes that should be casted to native types.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $casts = [
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Validation rules
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
public static $rules = [
|
2017-07-03 04:03:25 +08:00
|
|
|
'icao' => 'required|unique:airports'
|
2017-06-12 00:36:16 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
public function save(array $options = [])
|
|
|
|
{
|
|
|
|
if(in_array('icao', $options)) {
|
|
|
|
$options['icao'] = strtoupper($options['icao']);
|
|
|
|
}
|
|
|
|
|
|
|
|
return parent::save($options);
|
|
|
|
}
|
|
|
|
}
|