*/ 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, ]); } }