2017-12-21 06:34:52 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
2017-12-26 05:19:34 +08:00
|
|
|
class Navdata extends BaseModel
|
2017-12-21 06:34:52 +08:00
|
|
|
{
|
|
|
|
public $table = 'navdata';
|
|
|
|
public $timestamps = false;
|
|
|
|
public $incrementing = false;
|
|
|
|
|
|
|
|
public $fillable = [
|
|
|
|
'id',
|
|
|
|
'name',
|
|
|
|
'type',
|
|
|
|
'lat',
|
|
|
|
'lon',
|
|
|
|
'freq',
|
|
|
|
];
|
|
|
|
|
|
|
|
public $casts = [
|
2017-12-21 09:12:39 +08:00
|
|
|
'type' => 'integer',
|
|
|
|
'lat' => 'float',
|
|
|
|
'lon' => 'float',
|
2018-01-02 03:48:02 +08:00
|
|
|
'freq' => 'float',
|
2017-12-21 06:34:52 +08:00
|
|
|
];
|
2018-01-02 03:48:02 +08:00
|
|
|
|
|
|
|
protected static function boot()
|
|
|
|
{
|
|
|
|
parent::boot();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Make sure the ID is all caps
|
|
|
|
*/
|
|
|
|
static::creating(function (Navdata $model) {
|
|
|
|
if (!empty($model->id)) {
|
|
|
|
$model->id = strtoupper($model->id);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2017-12-21 06:34:52 +08:00
|
|
|
}
|