mein-sterntours/database/factories/LeadFactory.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

60 lines
2.1 KiB
PHP

<?php
namespace Database\Factories;
use App\Models\Lead;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Lead>
*/
class LeadFactory extends Factory
{
protected $model = Lead::class;
public function definition(): array
{
$start = fake()->dateTimeBetween('+1 month', '+6 months');
$end = fake()->dateTimeBetween($start, '+12 months');
return [
'customer_id' => CustomerFactory::new(),
'request_date' => now()->format('Y-m-d'),
'travelperiod_start' => $start->format('Y-m-d'),
'travelperiod_end' => $end->format('Y-m-d'),
'travelperiod_length' => (int) $start->diff($end)->days,
'travelcountry_id' => null,
'travelagenda_id' => null,
'remarks' => '',
'sf_guard_user_id' => null,
'is_closed' => false,
'initialcontacttype_id' => null,
'searchengine_id' => null,
'searchengine_keywords' => '',
'status_id' => 1,
'next_due_date' => now()->addDays(7)->format('Y-m-d'),
'website_id' => null,
'travelcategory_id' => null,
'price' => 0.0,
'pax' => 2,
'participant_name' => fake()->lastName(),
'participant_firstname' => fake()->firstName(),
'participant_birthdate' => fake()->dateTimeBetween('-60 years', '-18 years')->format('Y-m-d'),
'participant_salutation_id' => 1,
];
}
public function closed(): static
{
return $this->state(fn (array $attributes) => [
'is_closed' => true,
]);
}
public function withPrice(float $price): static
{
return $this->state(fn (array $attributes) => [
'price' => $price,
]);
}
}