Event addons bookable

This commit is contained in:
2026-08-12 16:45:02 +02:00
parent e95de52768
commit 0ee952212b
25 changed files with 656 additions and 24 deletions
@@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::table('events', function (Blueprint $table) {
// Buchbare Zusätze (Event-Addons) als Ja/Nein-Optionen mit Preis.
// Struktur: [ { key, title, description, price, flat } ]
$table->json('addons')->nullable();
});
}
public function down(): void
{
Schema::table('events', function (Blueprint $table) {
$table->dropColumn('addons');
});
}
};
@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
// Gewählte Zusätze je Anmeldung -- eine Zeile pro gebuchtem Addon.
// Titel/Preis/Betrag werden als Snapshot mitgespeichert (relevant für die spätere Rechnung).
Schema::create('event_participant_addons', function (Blueprint $table) {
$table->id();
$table->string('tenant');
$table->foreignId('event_id')->constrained('events', 'id')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreignId('event_participant_id')->constrained('event_participants', 'id')->cascadeOnDelete()->cascadeOnUpdate();
$table->string('addon_key');
$table->string('title');
$table->float('price')->default(0);
$table->boolean('flat')->default(false);
$table->integer('days')->default(0);
$table->float('amount')->default(0);
$table->timestamps();
$table->foreign('tenant')->references('slug')->on('tenants')->restrictOnDelete()->cascadeOnUpdate();
});
}
public function down(): void
{
Schema::dropIfExists('event_participant_addons');
}
};