feat: adapt device models api
Some checks are pending
tests / ci (push) Waiting to run

This commit is contained in:
Benjamin Nussbaum 2025-08-16 09:41:00 +02:00
parent a88e72b75e
commit ba3bf31bb7
29 changed files with 2379 additions and 215 deletions

View file

@ -182,7 +182,10 @@ class Device extends Model
{
return $this->belongsTo(Firmware::class, 'update_firmware_id');
}
public function deviceModel(): BelongsTo
{
return $this->belongsTo(DeviceModel::class);
}
public function logs(): HasMany
{
return $this->hasMany(DeviceLog::class);

View file

@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
final class DeviceModel extends Model
{
use HasFactory;
protected $guarded = ['id'];
protected $casts = [
'width' => 'integer',
'height' => 'integer',
'colors' => 'integer',
'bit_depth' => 'integer',
'scale_factor' => 'float',
'rotation' => 'integer',
'offset_x' => 'integer',
'offset_y' => 'integer',
'published_at' => 'datetime',
];
}