Event addons bookable
This commit is contained in:
@@ -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');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user