krgm.so-manager-dev.com/app/Models/Device.php
kin.rinzen 5b01165319
All checks were successful
Deploy main / deploy (push) Successful in 22s
デバイス管理マスタ画面修正
2025-10-07 16:01:12 +09:00

50 lines
1.1 KiB
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();
}
public static function deleteByPk(array $ids): int
{
return static::whereIn('device_id', $ids)->delete();
}
}