mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-13 15:07:49 +00:00
test: resolve phpstan issues
This commit is contained in:
parent
a1a57014b6
commit
c67a182cf2
3 changed files with 42 additions and 15 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue