siakad-itm/database/factories/UserProfileFactory.php
Yoga Pangestu 07a00a92a2
Some checks failed
tests / ci (pull_request) Has been cancelled
Refactor lecturer management to support multiple departments
- Updated LecturerController to load multiple departments for lecturers.
- Modified LecturerRequest to accept an array of department IDs instead of a single department ID.
- Changed Department model to establish a many-to-many relationship with Lecturer.
- Adjusted Lecturer model to reflect the new many-to-many relationship with Department.
- Updated LecturerService to handle multiple departments during creation and updates.
- Created LecturerFactory and StudentFactory for generating test data.
- Added a migration for the new lecturer_department pivot table.
- Refactored seeder classes to accommodate the new structure for lecturers and departments.
- Enhanced frontend components for creating and editing lecturers to support multiple department selection.
2026-08-30 12:18:13 +07:00

31 lines
814 B
PHP

<?php
namespace Database\Factories;
use App\Enums\Gender;
use App\Models\UserProfile;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<UserProfile>
*/
class UserProfileFactory extends Factory
{
protected $model = UserProfile::class;
public function definition(): array
{
$gender = fake()->randomElement(Gender::cases());
$faker = fake('id_ID');
return [
'full_name' => $faker->name($gender === Gender::Male ? 'male' : 'female'),
'phone_number' => '08'.fake()->numerify('##########'),
'address' => $faker->address(),
'gender' => $gender,
'birth_date' => fake()->dateTimeBetween('-55 years', '-18 years')->format('Y-m-d'),
'birth_place' => $faker->city(),
];
}
}