presseportale/database/factories/CompanyFactory.php
Kevin Adametz 5b8bdf4182
Some checks are pending
linter / quality (push) Waiting to run
tests / ci (push) Waiting to run
12-05-2026 Frontend dev
2026-05-12 18:32:33 +02:00

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