31 lines
576 B
PHP
31 lines
576 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace Database\Factories;
|
||
|
|
|
||
|
|
use App\Models\Planner;
|
||
|
|
use App\Models\User;
|
||
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @extends Factory<User>
|
||
|
|
*/
|
||
|
|
class UserFactory extends Factory
|
||
|
|
{
|
||
|
|
protected static ?string $password;
|
||
|
|
|
||
|
|
public function definition(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'planner_id' => null,
|
||
|
|
'name' => fake()->name(),
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function planner(Planner $planner): self
|
||
|
|
{
|
||
|
|
return $this->state(fn (array $attributes) => [
|
||
|
|
'planner_id' => $planner->id,
|
||
|
|
]);
|
||
|
|
}
|
||
|
|
}
|