feat: calculate scale level, limit to 4-bit

This commit is contained in:
Benjamin Nussbaum 2025-09-18 19:44:02 +02:00
parent 8791a5154e
commit 85e887f8a5
2 changed files with 31 additions and 0 deletions

View file

@ -31,6 +31,35 @@ final class DeviceModel extends Model
return null;
}
//if higher then 4 return 4bit
if ($this->bit_depth > 4) {
return '4bit';
}
return $this->bit_depth.'bit';
}
/**
* Returns the scale level based on the device width.
*/
public function getScaleLevelAttribute(): ?string
{
if (! $this->width) {
return null;
}
if ($this->width > 800 && $this->width <= 1000) {
return 'large';
}
if ($this->width > 1000 && $this->width <= 1400) {
return 'xlarge';
}
if ($this->width > 1400) {
return 'xxlarge';
}
return null;
}
}