53 lines
899 B
PHP
53 lines
899 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Eloquent as Model;
|
|
|
|
/**
|
|
* Class Airport
|
|
* @package App\Models
|
|
*/
|
|
class Airport extends Model
|
|
{
|
|
public $table = 'airports';
|
|
public $timestamps = false;
|
|
|
|
public $fillable = [
|
|
'id',
|
|
'icao',
|
|
'name',
|
|
'location',
|
|
'lat',
|
|
'lon',
|
|
'fuel_100ll_cost',
|
|
'fuel_jeta_cost',
|
|
'fuel_mogas_cost',
|
|
];
|
|
|
|
/**
|
|
* Validation rules
|
|
*
|
|
* @var array
|
|
*/
|
|
public static $rules = [
|
|
#'icao' => 'required|unique:airports'
|
|
];
|
|
|
|
/**
|
|
* Some fancy callbacks
|
|
*/
|
|
protected static function boot() {
|
|
|
|
parent::boot();
|
|
|
|
/**
|
|
* Make sure the ID is set to the ICAO
|
|
*/
|
|
static::creating(function (Airport $model) {
|
|
$model->icao = strtoupper($model->icao);
|
|
$model->id = $model->icao;
|
|
});
|
|
}
|
|
}
|