so-manager-dev.com/app/Models/Device.php
2025-09-19 19:01:21 +09:00

45 lines
967 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Device extends Model
{
protected $table = 'device';
protected $primaryKey = 'device_id';
public $incrementing = true;
protected $keyType = 'int';
protected $fillable = [
'park_id',
'device_type',
'device_subject',
'device_identifier',
'device_work',
'device_workstart',
'device_replace',
'device_remarks',
'operator_id',
];
protected $casts = [
'park_id' => 'integer',
'device_workstart' => 'date',
'device_replace' => 'date',
'operator_id' => 'integer',
];
public function park()
{
return $this->belongsTo(Park::class, 'park_id', 'park_id');
}
public static function getList(): array
{
return static::orderBy('device_subject')->pluck('device_subject', 'device_id')->toArray();
}
}