This commit is contained in:
Masroor Ehsan 2025-01-22 18:50:42 +06:00
parent 0593602452
commit 39bc8264aa
2 changed files with 18 additions and 7 deletions

View File

@ -42,7 +42,8 @@ public function definition(): array
'remember_token' => Str::random(10), 'remember_token' => Str::random(10),
'profile_photo_path' => null, 'profile_photo_path' => null,
'current_team_id' => null, 'current_team_id' => null,
'institute_id' => null, 'organization_id' => null,
'department_id' => null,
'is_active' => fake()->boolean(), 'is_active' => fake()->boolean(),
]; ];
} }

View File

@ -3,8 +3,8 @@
namespace Database\Seeders; namespace Database\Seeders;
use App\Domain\ACL\Role; use App\Domain\ACL\Role;
use App\Models\Department;
use App\Models\Organization; use App\Models\Organization;
use App\Models\RadiologistProfile;
use App\Models\User; use App\Models\User;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
@ -36,9 +36,10 @@ public function run(): void
$chevron = Organization::where('name', 'Chevron')->first(); $chevron = Organization::where('name', 'Chevron')->first();
$cmch = Organization::where('name', 'CMCH')->first(); $cmch = Organization::where('name', 'CMCH')->first();
$chev_xr = Department::where('organization_id', $chevron->id)->first();
User::factory(4) User::factory(4)
->create([ ->create([
'institute_id' => $chevron->id, 'organization_id' => $chevron->id,
]) ])
->each(function ($u, $key) { ->each(function ($u, $key) {
$u->assignRole(Role::Technician); $u->assignRole(Role::Technician);
@ -47,9 +48,21 @@ public function run(): void
]); ]);
}); });
User::factory(2)
->create([
'organization_id' => $chevron->id,
'department_id' => $chev_xr->id,
])
->each(function ($u, $key) {
$u->assignRole(Role::Technician);
$u->update([
'username' => sprintf('xrtech%d', $key + 1),
]);
});
User::factory(4) User::factory(4)
->create([ ->create([
'institute_id' => $cmch->id, 'organization_id' => $cmch->id,
]) ])
->each(function ($u, $key) { ->each(function ($u, $key) {
$u->assignRole(Role::Technician); $u->assignRole(Role::Technician);
@ -70,9 +83,6 @@ public function run(): void
$u->update([ $u->update([
'display_name' => sprintf('Dr. %s.%d', $u->first_name, $key + 1), 'display_name' => sprintf('Dr. %s.%d', $u->first_name, $key + 1),
'username' => sprintf('rad%d', $key + 1), 'username' => sprintf('rad%d', $key + 1),
]);
RadiologistProfile::create([
'user_id' => $u->id,
'signature_image_path' => 'signatures/' . fake()->randomElement($images), 'signature_image_path' => 'signatures/' . fake()->randomElement($images),
]); ]);
}); });