e0dfc3ec82
API CI/CD / Validate (composer + pint) (push) Successful in 3m15s
API CI/CD / Test (PHPUnit) (push) Failing after 5m4s
API CI/CD / Build frontend assets (push) Successful in 1m3s
API CI/CD / Security audit (push) Failing after 49s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
38 lines
950 B
PHP
38 lines
950 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\ClassSection;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<ClassSection>
|
|
*/
|
|
class ClassSectionFactory extends Factory
|
|
{
|
|
protected $model = ClassSection::class;
|
|
|
|
public function state($state): static
|
|
{
|
|
if (is_array($state) && array_key_exists('section_name', $state)) {
|
|
$state['class_section_name'] = $state['section_name'];
|
|
unset($state['section_name']);
|
|
}
|
|
|
|
return parent::state($state);
|
|
}
|
|
|
|
public function definition(): array
|
|
{
|
|
$sectionId = fake()->numberBetween(1, 999);
|
|
|
|
return [
|
|
'class_id' => fake()->numberBetween(1, 20),
|
|
'class_section_id' => $sectionId,
|
|
'class_section_name' => (string) $sectionId.fake()->randomElement(['A', 'B', 'C']),
|
|
'semester' => 'Fall',
|
|
'school_year' => '2025-2026',
|
|
];
|
|
}
|
|
}
|