mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-03-14 20:33:40 +00:00
fix: enable backwards compatibility v1 rendering strategy
Some checks failed
tests / ci (push) Has been cancelled
Some checks failed
tests / ci (push) Has been cancelled
This commit is contained in:
parent
5eb442d9d6
commit
b8b6caba12
4 changed files with 45 additions and 6 deletions
|
|
@ -11,6 +11,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|||
|
||||
/**
|
||||
* @property-read array<string, string> $css_variables
|
||||
* @property-read string|null $css_name
|
||||
* @property-read DevicePalette|null $palette
|
||||
*/
|
||||
final class DeviceModel extends Model
|
||||
|
|
@ -74,6 +75,19 @@ final class DeviceModel extends Model
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns css_name for v2 (per-device sizing); for v1 returns 'og' to preserve legacy single-variant behaviour.
|
||||
*
|
||||
* @return Attribute<string|null, string|null>
|
||||
*/
|
||||
protected function cssName(): Attribute
|
||||
{
|
||||
/** @var Attribute<string|null, string|null> */
|
||||
return Attribute::get(
|
||||
fn (mixed $value): ?string => config('app.puppeteer_window_size_strategy') === 'v2' ? ($value !== null ? (string) $value : null) : 'og'
|
||||
);
|
||||
}
|
||||
|
||||
public function palette(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(DevicePalette::class, 'palette_id');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue