fix code practitionerseeder
This commit is contained in:
@@ -21,15 +21,15 @@ class PractitionerSeeder extends Seeder
|
|||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
$organizations = Organization::query()
|
$organizations = Organization::query()
|
||||||
->whereHas('metas', function ($meta) {
|
->whereHas('metas', function ($meta) {
|
||||||
$meta->where('type', 'KodeRS');
|
$meta->where('type', 'KodeRS');
|
||||||
})
|
})
|
||||||
->with('metas')
|
->with('metas')
|
||||||
->get();
|
->get();
|
||||||
$specialities = Speciality::pluck('id', 'name')->toArray();
|
$specialities = Speciality::pluck('id', 'name')->toArray();
|
||||||
|
|
||||||
foreach ($organizations as $organization) {
|
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) {
|
foreach ($response->json()['practitioners'] as $practitioner) {
|
||||||
$practitioner = json_decode(json_encode($practitioner));
|
$practitioner = json_decode(json_encode($practitioner));
|
||||||
@@ -57,7 +57,7 @@ class PractitionerSeeder extends Seeder
|
|||||||
|
|
||||||
$newPractitioner = Practitioner::updateOrCreate([
|
$newPractitioner = Practitioner::updateOrCreate([
|
||||||
'person_id' => $newPerson->id
|
'person_id' => $newPerson->id
|
||||||
],[
|
], [
|
||||||
'person_id' => $newPerson->id
|
'person_id' => $newPerson->id
|
||||||
]);
|
]);
|
||||||
$newPractitioner->metas()->create([
|
$newPractitioner->metas()->create([
|
||||||
@@ -95,7 +95,7 @@ class PractitionerSeeder extends Seeder
|
|||||||
'type' => 'description',
|
'type' => 'description',
|
||||||
'value' => $practitioner->doctor->description ?? null,
|
'value' => $practitioner->doctor->description ?? null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -109,23 +109,23 @@ class PractitionerSeeder extends Seeder
|
|||||||
if (empty($newPractitionerRole->speciality_id)) {
|
if (empty($newPractitionerRole->speciality_id)) {
|
||||||
$newPractitionerRole->metas()->updateOrCreate([
|
$newPractitionerRole->metas()->updateOrCreate([
|
||||||
'type' => 'speciality_code',
|
'type' => 'speciality_code',
|
||||||
],[
|
], [
|
||||||
'system' => 'default',
|
'system' => 'default',
|
||||||
'type' => 'speciality_code',
|
'type' => 'speciality_code',
|
||||||
'value' => $practitioner->speciality->code ?? null,
|
'value' => $practitioner->speciality->code ?? null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$newPractitionerRole->metas()->updateOrCreate([
|
$newPractitionerRole->metas()->updateOrCreate([
|
||||||
'type' => 'speciality',
|
'type' => 'speciality',
|
||||||
],[
|
], [
|
||||||
'system' => 'default',
|
'system' => 'default',
|
||||||
'type' => 'speciality',
|
'type' => 'speciality',
|
||||||
'value' => $practitioner->speciality->name ?? null,
|
'value' => $practitioner->speciality->name ?? null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$newPractitionerRole->metas()->updateOrCreate([
|
$newPractitionerRole->metas()->updateOrCreate([
|
||||||
'type' => 'speciality_image',
|
'type' => 'speciality_image',
|
||||||
],[
|
], [
|
||||||
'system' => 'default',
|
'system' => 'default',
|
||||||
'type' => 'speciality_image',
|
'type' => 'speciality_image',
|
||||||
'value' => $practitioner->speciality->name ?? null,
|
'value' => $practitioner->speciality->name ?? null,
|
||||||
@@ -135,7 +135,7 @@ class PractitionerSeeder extends Seeder
|
|||||||
$newPractitionerRole->metas()->updateOrCreate([
|
$newPractitionerRole->metas()->updateOrCreate([
|
||||||
'type' => 'primaya-his',
|
'type' => 'primaya-his',
|
||||||
'type' => 'DokterID',
|
'type' => 'DokterID',
|
||||||
],[
|
], [
|
||||||
'system' => 'primaya-his',
|
'system' => 'primaya-his',
|
||||||
'type' => 'DokterID',
|
'type' => 'DokterID',
|
||||||
'value' => $practitioner->meta->DokterID ?? null,
|
'value' => $practitioner->meta->DokterID ?? null,
|
||||||
|
|||||||
Reference in New Issue
Block a user