fix code practitionerseeder

This commit is contained in:
Muhammad Fajar
2022-10-31 07:10:54 +07:00
parent a710ad1c81
commit e8d3dd76c2

View File

@@ -21,15 +21,15 @@ class PractitionerSeeder extends Seeder
public function run()
{
$organizations = Organization::query()
->whereHas('metas', function ($meta) {
$meta->where('type', 'KodeRS');
})
->with('metas')
->get();
->whereHas('metas', function ($meta) {
$meta->where('type', 'KodeRS');
})
->with('metas')
->get();
$specialities = Speciality::pluck('id', 'name')->toArray();
foreach ($organizations as $organization) {
$response = Http::get('https://api.primaya.id/temp/practitioners?code='.$organization->meta->KodeRS);
$response = Http::get('https://app.primaya.id/temp/practitioners?code=' . $organization->meta->KodeRS);
foreach ($response->json()['practitioners'] as $practitioner) {
$practitioner = json_decode(json_encode($practitioner));
@@ -57,7 +57,7 @@ class PractitionerSeeder extends Seeder
$newPractitioner = Practitioner::updateOrCreate([
'person_id' => $newPerson->id
],[
], [
'person_id' => $newPerson->id
]);
$newPractitioner->metas()->create([
@@ -95,7 +95,7 @@ class PractitionerSeeder extends Seeder
'type' => 'description',
'value' => $practitioner->doctor->description ?? null,
]);
@@ -109,23 +109,23 @@ class PractitionerSeeder extends Seeder
if (empty($newPractitionerRole->speciality_id)) {
$newPractitionerRole->metas()->updateOrCreate([
'type' => 'speciality_code',
],[
], [
'system' => 'default',
'type' => 'speciality_code',
'value' => $practitioner->speciality->code ?? null,
]);
$newPractitionerRole->metas()->updateOrCreate([
'type' => 'speciality',
],[
], [
'system' => 'default',
'type' => 'speciality',
'value' => $practitioner->speciality->name ?? null,
]);
$newPractitionerRole->metas()->updateOrCreate([
'type' => 'speciality_image',
],[
], [
'system' => 'default',
'type' => 'speciality_image',
'value' => $practitioner->speciality->name ?? null,
@@ -135,7 +135,7 @@ class PractitionerSeeder extends Seeder
$newPractitionerRole->metas()->updateOrCreate([
'type' => 'primaya-his',
'type' => 'DokterID',
],[
], [
'system' => 'primaya-his',
'type' => 'DokterID',
'value' => $practitioner->meta->DokterID ?? null,