39 lines
833 B
PHP
39 lines
833 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\SubscoreDefinition;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\ScoringGuide>
|
|
*/
|
|
class ScoringGuideFactory extends Factory
|
|
{
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'name' => $this->faker->sentence(3),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Configure the model factory.
|
|
*
|
|
* @return $this
|
|
*/
|
|
public function configure()
|
|
{
|
|
return $this->afterCreating(function ($scoringGuide) {
|
|
SubscoreDefinition::factory()
|
|
->count(5)
|
|
->create(['scoring_guide_id' => $scoringGuide->id]);
|
|
});
|
|
}
|
|
}
|