mein-sterntours/database/factories/BookingFactory.php
Phase-1-Rollback-Agent e3dc1afd8e WIP: Sicherheitsnetz vor Phase-1-R\u00fcckbau
Enth\u00e4lt gemischt: Laravel-10-Upgrade + Phase 1 (Contacts-Modul, Duplicats-Commands,
Soft-Delete+Merge-Fields) + Phase 2 Code-Umstellungen (inquiry_id, $table='contacts'/'inquiries')
+ Offers-Modul (Migrationen, Models, offer_id in Booking, offer-Disk in filesystems.php).

Phase 2 + Offers werden im folgenden Commit nach dev/backups/phase2-offers-2026-04-17/
verschoben, damit der Workspace auf Phase-1-only (= Test-System-Stand) reduziert ist
und direkt auf Live deploybar wird.

Tarball-Backup zus\u00e4tzlich unter: ../backups-safety/workspace-pre-phase1-rollback-2026-04-17.tar.gz

Made-with: Cursor
2026-04-17 13:40:31 +00:00

69 lines
2.6 KiB
PHP

<?php
namespace Database\Factories;
use App\Models\Booking;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Booking>
*/
class BookingFactory extends Factory
{
protected $model = Booking::class;
public function definition(): array
{
$start = fake()->dateTimeBetween('+1 month', '+6 months');
$end = fake()->dateTimeBetween($start, '+12 months');
return [
'customer_id' => CustomerFactory::new(),
'lead_id' => LeadFactory::new(),
'booking_date' => now()->format('Y-m-d'),
'start_date' => $start->format('Y-m-d'),
'end_date' => $end->format('Y-m-d'),
'sf_guard_user_id' => null,
'branch_id' => null,
'service_fee' => 0.0,
'travel_country_id' => null,
'travel_category_id' => null,
'pax' => 2,
'coupon_id' => null,
'title' => fake()->sentence(4),
'travel_number' => strtoupper(fake()->bothify('??####')),
'participant_name' => fake()->lastName(),
'participant_firstname' => fake()->firstName(),
'participant_birthdate' => fake()->dateTimeBetween('-60 years', '-18 years')->format('Y-m-d'),
'participant_salutation_id' => 1,
'ev_number' => '',
'merlin_knr' => '',
'merlin_order_number' => '',
'travel_company_id' => null,
'travel_documents' => false,
'price' => fake()->randomFloat(2, 500, 5000),
'price_total' => 0.0,
'deposit_total' => 0.0,
'final_payment' => 0.0,
'final_payment_date' => null,
'travelagenda_id' => null,
'website_id' => null,
'new_drafts' => false,
];
}
public function canceled(): static
{
return $this->state(fn (array $attributes) => [
'canceled' => 1.0,
]);
}
public function withPrice(float $price): static
{
return $this->state(fn (array $attributes) => [
'price' => $price,
'price_total' => $price,
]);
}
}