50 lines
1.3 KiB
PHP
50 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Enums\CompanyType;
|
|
use App\Enums\Portal;
|
|
use App\Models\Company;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Str;
|
|
|
|
/**
|
|
* @extends Factory<Company>
|
|
*/
|
|
class CompanyFactory extends Factory
|
|
{
|
|
protected $model = Company::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
$name = fake()->company();
|
|
|
|
return [
|
|
'portal' => fake()->randomElement([Portal::Presseecho->value, Portal::Businessportal24->value]),
|
|
'type' => fake()->randomElement(CompanyType::cases())->value,
|
|
'name' => $name,
|
|
'slug' => Str::slug($name).'-'.fake()->unique()->numberBetween(1000, 9999),
|
|
'address' => fake()->streetAddress(),
|
|
'country_code' => 'DE',
|
|
'phone' => fake()->phoneNumber(),
|
|
'email' => fake()->companyEmail(),
|
|
'website' => fake()->url(),
|
|
'is_active' => true,
|
|
];
|
|
}
|
|
|
|
public function presseecho(): static
|
|
{
|
|
return $this->state(['portal' => Portal::Presseecho->value]);
|
|
}
|
|
|
|
public function businessportal24(): static
|
|
{
|
|
return $this->state(['portal' => Portal::Businessportal24->value]);
|
|
}
|
|
|
|
public function inactive(): static
|
|
{
|
|
return $this->state(['is_active' => false]);
|
|
}
|
|
}
|