Update PractitionerSeeder
This commit is contained in:
@@ -16,7 +16,7 @@ class OrganizationSeeder extends Seeder
|
|||||||
*/
|
*/
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
$response = Http::get('http://localhost:8001/temp/organizations');
|
$response = Http::get('https://api.primaya.id/temp/organizations');
|
||||||
|
|
||||||
foreach ($response->json()['organizations'] as $organization) {
|
foreach ($response->json()['organizations'] as $organization) {
|
||||||
$newOrganization = Organization::updateOrCreate([
|
$newOrganization = Organization::updateOrCreate([
|
||||||
|
|||||||
@@ -20,11 +20,16 @@ class PractitionerSeeder extends Seeder
|
|||||||
*/
|
*/
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
$organizations = Organization::with(['metas'])->get();
|
$organizations = Organization::query()
|
||||||
|
->whereHas('metas', function ($meta) {
|
||||||
|
$meta->where('type', 'KodeRS');
|
||||||
|
})
|
||||||
|
->with('metas')
|
||||||
|
->get();
|
||||||
$specialities = Speciality::pluck('id', 'name')->toArray();
|
$specialities = Speciality::pluck('id', 'name')->toArray();
|
||||||
|
|
||||||
foreach ($organizations as $organization) {
|
foreach ($organizations as $organization) {
|
||||||
$response = Http::get('http://localhost:8001/temp/practitioners?code='.$organization->meta->KodeRS);
|
$response = Http::get('https://api.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));
|
||||||
|
|||||||
Reference in New Issue
Block a user