46 lines
1 KiB
PHP
46 lines
1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Site;
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
class SiteFactory extends Factory
|
|
{
|
|
/**
|
|
* The name of the factory's corresponding model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $model = Site::class;
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'name' => fake()->company(),
|
|
'url_re7' => fake()->url(),
|
|
'url_prod' => fake()->url(),
|
|
'gitlab_project_id' => fake()->optional()->randomNumber(4),
|
|
'brand_id' => null,
|
|
'project_manager_id' => null,
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Indique que le site a un chef de projet assigné.
|
|
*/
|
|
public function withProjectManager(): static
|
|
{
|
|
return $this->state(fn(array $attributes) => [
|
|
'project_manager_id' => User::factory(),
|
|
]);
|
|
}
|
|
}
|