58 lines
2.3 KiB
PHP
58 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Models\InviteLayout;
|
|
use App\Support\JoinTokenLayoutRegistry;
|
|
use Illuminate\Database\Seeder;
|
|
use ReflectionClass;
|
|
|
|
class InviteLayoutSeeder extends Seeder
|
|
{
|
|
public function run(): void
|
|
{
|
|
$reflection = new ReflectionClass(JoinTokenLayoutRegistry::class);
|
|
$layoutsConst = $reflection->getReflectionConstant('LAYOUTS');
|
|
$fallbackLayouts = $layoutsConst ? $layoutsConst->getValue() : [];
|
|
|
|
foreach ($fallbackLayouts as $layout) {
|
|
$preview = [
|
|
'background' => $layout['background'] ?? null,
|
|
'background_gradient' => $layout['background_gradient'] ?? null,
|
|
'accent' => $layout['accent'] ?? null,
|
|
'secondary' => $layout['secondary'] ?? null,
|
|
'text' => $layout['text'] ?? null,
|
|
'badge' => $layout['badge'] ?? null,
|
|
'qr' => $layout['qr'] ?? ['size_px' => 320],
|
|
'svg' => $layout['svg'] ?? ['width' => 1080, 'height' => 1520],
|
|
];
|
|
|
|
$options = [
|
|
'badge_label' => $layout['badge_label'] ?? 'Digitale Gästebox',
|
|
'instructions_heading' => $layout['instructions_heading'] ?? "So funktioniert's",
|
|
'link_heading' => $layout['link_heading'] ?? 'Alternative zum Einscannen',
|
|
'cta_label' => $layout['cta_label'] ?? 'Scan mich & starte direkt',
|
|
'cta_caption' => $layout['cta_caption'] ?? 'Scan mich & starte direkt',
|
|
'link_label' => $layout['link_label'] ?? null,
|
|
'logo_url' => $layout['logo_url'] ?? null,
|
|
'formats' => $layout['formats'] ?? ['pdf', 'svg'],
|
|
];
|
|
|
|
InviteLayout::updateOrCreate(
|
|
['slug' => $layout['id']],
|
|
[
|
|
'name' => $layout['name'],
|
|
'subtitle' => $layout['subtitle'] ?? null,
|
|
'description' => $layout['description'] ?? null,
|
|
'paper' => $layout['paper'] ?? 'a4',
|
|
'orientation' => $layout['orientation'] ?? 'portrait',
|
|
'preview' => $preview,
|
|
'layout_options' => $options,
|
|
'instructions' => $layout['instructions'] ?? [],
|
|
'is_active' => true,
|
|
]
|
|
);
|
|
}
|
|
}
|
|
}
|