34 lines
830 B
PHP
34 lines
830 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\HistoricalSeat;
|
|
use App\Models\Student;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Carbon;
|
|
|
|
class HistoricalSeatFactory extends Factory
|
|
{
|
|
protected $model = HistoricalSeat::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'created_at' => Carbon::now(),
|
|
'updated_at' => Carbon::now(),
|
|
'year' => $this->faker->randomNumber(),
|
|
'seat_description' => $this->faker->text(),
|
|
'student_id' => Student::factory(),
|
|
];
|
|
}
|
|
|
|
public function forStudent(Student $student): self
|
|
{
|
|
return $this->state(function (array $attributes) use ($student) {
|
|
return [
|
|
'student_id' => $student->id,
|
|
];
|
|
});
|
|
}
|
|
}
|