test: resolve phpstan issues

This commit is contained in:
Benjamin Nussbaum 2025-09-24 19:35:06 +02:00
parent a1a57014b6
commit c67a182cf2
3 changed files with 42 additions and 15 deletions

View file

@ -10,6 +10,9 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Facades\Storage;
/**
* @property-read DeviceModel|null $deviceModel
*/
class Device extends Model
{
use HasFactory;
@ -188,6 +191,30 @@ class Device extends Model
return $this->belongsTo(DeviceModel::class);
}
/**
* Get the color depth string (e.g., "4bit") for the associated device model.
*/
public function colorDepth(): ?string
{
return $this->deviceModel?->color_depth;
}
/**
* Get the scale level (e.g., large/xlarge/xxlarge) for the associated device model.
*/
public function scaleLevel(): ?string
{
return $this->deviceModel?->scale_level;
}
/**
* Get the device variant name, defaulting to 'og' if not available.
*/
public function deviceVariant(): string
{
return $this->deviceModel->name ?? 'og';
}
public function logs(): HasMany
{
return $this->hasMany(DeviceLog::class);