removed invitelayout resources
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('invite_layouts', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('slug')->unique();
|
||||
$table->string('name');
|
||||
$table->string('subtitle')->nullable();
|
||||
$table->text('description')->nullable();
|
||||
$table->string('paper')->default('a4');
|
||||
$table->string('orientation')->default('portrait');
|
||||
$table->json('preview')->nullable();
|
||||
$table->json('layout_options')->nullable();
|
||||
$table->json('instructions')->nullable();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->unsignedBigInteger('created_by')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('created_by')->references('id')->on('users')->nullOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('invite_layouts');
|
||||
}
|
||||
};
|
||||
@@ -1,77 +0,0 @@
|
||||
<?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() : [];
|
||||
$qrSizeOverrides = [
|
||||
'evergreen-vows' => 640,
|
||||
'midnight-gala' => 640,
|
||||
'garden-brunch' => 660,
|
||||
'sparkler-soiree' => 680,
|
||||
'confetti-bash' => 680,
|
||||
];
|
||||
$defaultQrSize = 640;
|
||||
$targetSvgWidth = 1240;
|
||||
$targetSvgHeight = 1754;
|
||||
|
||||
foreach ($fallbackLayouts as $layout) {
|
||||
$layoutId = $layout['id'] ?? null;
|
||||
$forcedQrSize = $qrSizeOverrides[$layoutId] ?? $defaultQrSize;
|
||||
$existingQrSize = (int) ($layout['qr']['size_px'] ?? $layout['qr_size_px'] ?? 0);
|
||||
$qrSize = max($existingQrSize, $forcedQrSize);
|
||||
|
||||
$existingSvgWidth = (int) ($layout['svg']['width'] ?? $layout['svg_width'] ?? 0);
|
||||
$existingSvgHeight = (int) ($layout['svg']['height'] ?? $layout['svg_height'] ?? 0);
|
||||
$svgWidth = max($existingSvgWidth, $targetSvgWidth);
|
||||
$svgHeight = max($existingSvgHeight, $targetSvgHeight);
|
||||
|
||||
$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' => ['size_px' => $qrSize],
|
||||
'svg' => ['width' => $svgWidth, 'height' => $svgHeight],
|
||||
];
|
||||
|
||||
$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', 'png'],
|
||||
];
|
||||
|
||||
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,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user