b2in/database/factories/PartnerFactory.php
2026-02-20 17:57:50 +01:00

79 lines
1.7 KiB
PHP

<?php
namespace Database\Factories;
use App\Models\Partner;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
/**
* @extends Factory<Partner>
*/
class PartnerFactory extends Factory
{
protected $model = Partner::class;
public function definition(): array
{
$company = fake()->company();
return [
'company_name' => $company,
'slug' => Str::slug($company).'-'.fake()->unique()->numberBetween(100, 999),
'type' => 'Retailer',
'is_active' => true,
];
}
/**
* Händler (Retailer).
*/
public function retailer(): static
{
return $this->state(fn (array $attributes) => [
'type' => 'Retailer',
'delivery_radius_km' => fake()->numberBetween(10, 100),
]);
}
/**
* Hersteller (Manufacturer).
*/
public function manufacturer(): static
{
return $this->state(fn (array $attributes) => [
'type' => 'Manufacturer',
]);
}
/**
* Makler (Estate-Agent).
*/
public function estateAgent(): static
{
return $this->state(fn (array $attributes) => [
'type' => 'Estate-Agent',
]);
}
/**
* Partner mit Setup abgeschlossen.
*/
public function setupCompleted(): static
{
return $this->state(fn (array $attributes) => [
'setup_completed' => true,
'setup_completed_at' => now(),
]);
}
/**
* Inaktiver Partner.
*/
public function inactive(): static
{
return $this->state(fn (array $attributes) => [
'is_active' => false,
]);
}
}