29 lines
642 B
PHP
29 lines
642 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\School;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Student>
|
|
*/
|
|
class StudentFactory extends Factory
|
|
{
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
$school = School::factory()->create();
|
|
return [
|
|
'school_id' => $school->id,
|
|
'first_name' => fake()->firstName(),
|
|
'last_name' => fake()->lastName(),
|
|
'grade' => rand(7,12),
|
|
];
|
|
}
|
|
}
|