Files
go-no-go/database/factories/ScreeningFactory.php
2026-02-03 20:18:08 +01:00

54 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Models\Screening;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* Factory for generating Screening test data.
*
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Screening>
*/
final class ScreeningFactory extends Factory
{
protected $model = Screening::class;
/**
* Define the model's default state.
*/
public function definition(): array
{
return [
'user_id' => User::factory(),
'score' => null,
'passed' => null,
];
}
/**
* Indicate that the screening passed.
*/
public function passed(): static
{
return $this->state(fn (array $attributes) => [
'score' => 10,
'passed' => true,
]);
}
/**
* Indicate that the screening failed.
*/
public function failed(): static
{
return $this->state(fn (array $attributes) => [
'score' => 3,
'passed' => false,
]);
}
}