50 lines
734 B
PHP
50 lines
734 B
PHP
|
<?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 = [
|
||
|
'icao'
|
||
|
];
|
||
|
|
||
|
/**
|
||
|
* The attributes that should be casted to native types.
|
||
|
*
|
||
|
* @var array
|
||
|
*/
|
||
|
protected $casts = [
|
||
|
|
||
|
];
|
||
|
|
||
|
/**
|
||
|
* Validation rules
|
||
|
*
|
||
|
* @var array
|
||
|
*/
|
||
|
public static $rules = [
|
||
|
'icao' => 'required'
|
||
|
];
|
||
|
|
||
|
public function save(array $options = [])
|
||
|
{
|
||
|
if(in_array('icao', $options)) {
|
||
|
$options['icao'] = strtoupper($options['icao']);
|
||
|
}
|
||
|
|
||
|
return parent::save($options);
|
||
|
}
|
||
|
}
|