Phase 2: Kalender, Anfrage, Vorreservierung & Sonderangebote

- Gäste, Buchungen (Status-Workflow), Sperrzeiten, Sonderangebote
- Vorreservierung mit Haltezeit je Wohnung; abgelaufene Holds geben den Kalender sofort frei, Cron setzt Status und benachrichtigt
- Sonderangebote/Sonderkonditionen: %, € pro Aufenthalt, Sonderpreis/Nacht, Gratis-Nächte; Bedingungen u. a. Saison, Vorlauf, Wochentag, Nächte, Aktionscode; bestes Einzel- vs. kombinierte Angebote
- Öffentliche Seite /buchen: Belegungskalender, Live-Preis, Anfrageformular (Honeypot, Rate-Limit)
- E-Mails: Angebot an Gast, Benachrichtigung Vermieter, Bestätigung, Absage, Ablauf
- Filament: Anfragen & Buchungen (bestätigen, ablehnen, verlängern, stornieren, Telefonbuchung), Gäste, Sperrzeiten, Sonderangebote
- Deutsche Validierungstexte

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lars StommerandClaude Opus 5.5 committed 2026-10-22 09:43:12 +02:00
1 parent 2e9a391b37
commit 08b6582fa1
79 files changed
+6213 -76

No files matched your search

@@ -0,0 +1,31 @@
<?php
namespace Database\Factories;
use App\Models\BlockedPeriod;
use App\Models\Property;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<BlockedPeriod>
*/
class BlockedPeriodFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
$startsOn = now()->addDays(fake()->numberBetween(30, 200))->startOfDay();
return [
'property_id' => Property::factory(),
'starts_on' => $startsOn->toDateString(),
'ends_on' => $startsOn->copy()->addDays(5)->toDateString(),
'reason' => 'Eigennutzung',
'source' => 'manual',
];
}
}
+46
View File
@@ -0,0 +1,46 @@
<?php
namespace Database\Factories;
use App\Enums\BookingStatus;
use App\Models\Booking;
use App\Models\Guest;
use App\Models\Property;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<Booking>
*/
class BookingFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
$arrival = now()->addDays(fake()->numberBetween(30, 200))->startOfDay();
return [
'property_id' => Property::factory(),
'guest_id' => Guest::factory(),
'status' => BookingStatus::Confirmed,
'arrival' => $arrival->toDateString(),
'departure' => $arrival->copy()->addDays(7)->toDateString(),
'guests' => 2,
'quote' => [],
'total' => 80000,
'deposit' => 20000,
'balance_due_on' => $arrival->copy()->subDays(28)->toDateString(),
];
}
public function reserved(?\DateTimeInterface $holdExpiresAt = null): static
{
return $this->state(fn (): array => [
'status' => BookingStatus::Reserved,
'hold_expires_at' => $holdExpiresAt ?? now()->addHours(48),
]);
}
}
+31
View File
@@ -0,0 +1,31 @@
<?php
namespace Database\Factories;
use App\Models\Guest;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<Guest>
*/
class GuestFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'first_name' => fake()->firstName(),
'last_name' => fake()->lastName(),
'email' => fake()->unique()->safeEmail(),
'phone' => fake()->phoneNumber(),
'street' => fake()->streetAddress(),
'postal_code' => fake()->postcode(),
'city' => fake()->city(),
'country' => 'DE',
];
}
}
@@ -0,0 +1,32 @@
<?php
namespace Database\Factories;
use App\Enums\DiscountType;
use App\Models\Property;
use App\Models\SpecialOffer;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<SpecialOffer>
*/
class SpecialOfferFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'property_id' => Property::factory(),
'name' => 'Sonderangebot',
'is_active' => true,
'is_public' => true,
'is_combinable' => false,
'discount_type' => DiscountType::Percent,
'discount_value' => 10,
];
}
}
@@ -0,0 +1,37 @@
<?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('guests', function (Blueprint $table) {
$table->id();
$table->string('first_name');
$table->string('last_name');
$table->string('email')->index();
$table->string('phone')->nullable();
$table->string('street')->nullable();
$table->string('postal_code', 20)->nullable();
$table->string('city')->nullable();
$table->string('country', 2)->default('DE');
$table->string('locale', 5)->default('de');
$table->text('notes')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('guests');
}
};
@@ -0,0 +1,48 @@
<?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('bookings', function (Blueprint $table) {
$table->id();
$table->string('reference')->nullable()->unique();
$table->foreignId('property_id')->constrained()->restrictOnDelete();
$table->foreignId('guest_id')->constrained()->restrictOnDelete();
$table->string('status')->index();
$table->string('source')->default('website');
$table->date('arrival');
$table->date('departure');
$table->unsignedTinyInteger('guests');
$table->json('extras')->nullable();
$table->string('promo_code')->nullable();
$table->json('quote');
$table->unsignedInteger('total');
$table->unsignedInteger('deposit');
$table->date('balance_due_on');
$table->dateTime('hold_expires_at')->nullable();
$table->text('message')->nullable();
$table->text('internal_notes')->nullable();
$table->dateTime('confirmed_at')->nullable();
$table->dateTime('cancelled_at')->nullable();
$table->timestamps();
$table->index(['property_id', 'arrival', 'departure']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('bookings');
}
};
@@ -0,0 +1,35 @@
<?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('blocked_periods', function (Blueprint $table) {
$table->id();
$table->foreignId('property_id')->constrained()->cascadeOnDelete();
$table->date('starts_on');
$table->date('ends_on');
$table->string('reason')->nullable();
$table->string('source')->default('manual');
$table->string('external_uid')->nullable();
$table->timestamps();
$table->index(['property_id', 'starts_on', 'ends_on']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('blocked_periods');
}
};
@@ -0,0 +1,46 @@
<?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('special_offers', function (Blueprint $table) {
$table->id();
$table->foreignId('property_id')->constrained()->cascadeOnDelete();
$table->string('name');
$table->string('public_description')->nullable();
$table->boolean('is_active')->default(true);
$table->boolean('is_public')->default(true);
$table->boolean('is_combinable')->default(false);
$table->string('code')->nullable();
$table->string('discount_type');
$table->unsignedInteger('discount_value');
$table->date('stay_from')->nullable();
$table->date('stay_until')->nullable();
$table->dateTime('bookable_from')->nullable();
$table->dateTime('bookable_until')->nullable();
$table->unsignedSmallInteger('min_days_before_arrival')->nullable();
$table->unsignedSmallInteger('max_days_before_arrival')->nullable();
$table->unsignedSmallInteger('min_nights')->nullable();
$table->unsignedSmallInteger('max_nights')->nullable();
$table->json('arrival_weekdays')->nullable();
$table->json('season_names')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('special_offers');
}
};
@@ -0,0 +1,28 @@
<?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::table('properties', function (Blueprint $table) {
$table->unsignedSmallInteger('hold_hours')->default(48)->after('balance_due_days_before_arrival');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('properties', function (Blueprint $table) {
$table->dropColumn('hold_hours');
});
}
};