51 lines
1.2 KiB
PHP
51 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Category;
|
|
use App\Models\Session;
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* Factory for generating Session test data.
|
|
*
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Session>
|
|
*/
|
|
final class SessionFactory extends Factory
|
|
{
|
|
protected $model = Session::class;
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'user_id' => User::factory(),
|
|
'category_id' => Category::factory(),
|
|
'screening_id' => null,
|
|
'status' => 'in_progress',
|
|
'score' => null,
|
|
'result' => null,
|
|
'additional_comments' => null,
|
|
'completed_at' => null,
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Indicate that the session is completed.
|
|
*/
|
|
public function completed(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'status' => 'completed',
|
|
'score' => 8,
|
|
'result' => 'consult_leadership',
|
|
'completed_at' => now(),
|
|
]);
|
|
}
|
|
}
|