phpvms/app/Models/Navdata.php

49 lines
844 B
PHP
Raw Permalink Normal View History

<?php
namespace App\Models;
use App\Contracts\Model;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Navdata extends Model
{
use HasFactory;
public $table = 'navdata';
2018-03-21 08:40:19 +08:00
protected $keyType = 'string';
public $timestamps = false;
public $incrementing = false;
2018-03-21 08:40:19 +08:00
protected $fillable = [
'id',
'name',
'type',
'lat',
'lon',
'freq',
];
2018-03-21 08:40:19 +08:00
protected $casts = [
'type' => 'integer',
'lat' => 'float',
'lon' => 'float',
'freq' => 'float',
];
/**
* Make sure the ID is in all caps
2018-08-27 00:40:04 +08:00
*
* @return Attribute
*/
public function id(): Attribute
{
return Attribute::make(
set: fn ($id) => strtoupper($id)
);
}
}