22 lines
449 B
PHP
22 lines
449 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
/**
|
|
* Current state only, one row per entity (pure upserts — stays small and fast).
|
|
*/
|
|
class DeviceState extends Model
|
|
{
|
|
protected $fillable = ['entity_id', 'state'];
|
|
|
|
protected $casts = ['state' => 'array'];
|
|
|
|
public function entity(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Entity::class);
|
|
}
|
|
}
|