blob: b5bc4ba4dee419ec83f43bc90fe7efa35063b271 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
<?php
namespace Database\Factories;
use App\Models\Diploma;
use App\Models\Student;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class StudentFactory extends Factory
{
protected $model = Student::class;
public function definition(): array
{
// Fetch all diploma IDs
$diplomaIds = Diploma::pluck('id')->toArray();
return [
'first_name' => $this->faker->name(),
'last_name' => $this->faker->lastName(),
'email' => $this->faker->unique()->safeEmail,
'password' => 'password',
'study_direction' => $this->faker->randomElement(['Informatica', 'Economie', 'Talen', 'Wetenschappen']),
// Use a random diploma ID or null if none exist
'graduation_track' => $this->faker->optional()->randomElement($diplomaIds),
'job_preferences' => $this->faker->sentence(3),
'cv' => 'cv_' . Str::random(10) . '.pdf',
'profile_complete' => false
];
}
}
|