finishes 13 and 14
This commit is contained in:
53
database/factories/ScreeningFactory.php
Normal file
53
database/factories/ScreeningFactory.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user