2017-12-21 06:34:52 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
2019-07-16 03:44:31 +08:00
|
|
|
use App\Contracts\Model;
|
2022-03-14 23:45:18 +08:00
|
|
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
2018-03-20 09:50:40 +08:00
|
|
|
|
|
|
|
class Navdata extends Model
|
2017-12-21 06:34:52 +08:00
|
|
|
{
|
2022-03-14 23:45:18 +08:00
|
|
|
use HasFactory;
|
|
|
|
|
2017-12-21 06:34:52 +08:00
|
|
|
public $table = 'navdata';
|
2018-03-21 08:40:19 +08:00
|
|
|
|
2019-09-13 20:05:02 +08:00
|
|
|
protected $keyType = 'string';
|
2022-03-14 23:45:18 +08:00
|
|
|
|
2017-12-21 06:34:52 +08:00
|
|
|
public $timestamps = false;
|
2022-03-14 23:45:18 +08:00
|
|
|
|
2017-12-21 06:34:52 +08:00
|
|
|
public $incrementing = false;
|
|
|
|
|
2018-03-21 08:40:19 +08:00
|
|
|
protected $fillable = [
|
2017-12-21 06:34:52 +08:00
|
|
|
'id',
|
|
|
|
'name',
|
|
|
|
'type',
|
|
|
|
'lat',
|
|
|
|
'lon',
|
|
|
|
'freq',
|
|
|
|
];
|
|
|
|
|
2018-03-21 08:40:19 +08:00
|
|
|
protected $casts = [
|
2018-03-20 09:50:40 +08:00
|
|
|
'type' => 'integer',
|
|
|
|
'lat' => 'float',
|
|
|
|
'lon' => 'float',
|
|
|
|
'freq' => 'float',
|
2017-12-21 06:34:52 +08:00
|
|
|
];
|
2018-01-02 03:48:02 +08:00
|
|
|
|
2018-03-19 09:37:35 +08:00
|
|
|
/**
|
|
|
|
* Make sure the ID is in all caps
|
2018-08-27 00:40:04 +08:00
|
|
|
*
|
2022-03-14 23:45:18 +08:00
|
|
|
* @return Attribute
|
2018-03-19 09:37:35 +08:00
|
|
|
*/
|
2022-03-14 23:45:18 +08:00
|
|
|
public function id(): Attribute
|
2018-01-02 03:48:02 +08:00
|
|
|
{
|
2022-03-14 23:45:18 +08:00
|
|
|
return Attribute::make(
|
|
|
|
set: fn ($id) => strtoupper($id)
|
|
|
|
);
|
2018-01-02 03:48:02 +08:00
|
|
|
}
|
2017-12-21 06:34:52 +08:00
|
|
|
}
|