list dokter, list RS
This commit is contained in:
38
Modules/Internal/Transformers/DoctorResource.php
Normal file
38
Modules/Internal/Transformers/DoctorResource.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Internal\Transformers;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class DoctorResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
$doctor = [
|
||||
'id' => $this->id,
|
||||
'his_dokter_id' => $this->meta->DokterID,
|
||||
'name' => $this->practitioner->person->name,
|
||||
'phone' => $this->practitioner->person->phone,
|
||||
'email' => $this->practitioner->person->email,
|
||||
'address' => $this->practitioner->person->currentAddress->text,
|
||||
'organization' => $this->organization->name,
|
||||
'organization_id' => $this->organization->id,
|
||||
'specialty' => $this->speciality->name,
|
||||
'specialtyI_id' => $this->speciality->id,
|
||||
'education' => $this->practitioner->meta->education,
|
||||
'experience' => $this->practitioner->meta->work_experience,
|
||||
'award' => $this->practitioner->meta->award,
|
||||
'keilmuan' => $this->practitioner->meta->Keilmuan,
|
||||
'tipe_dokter' => $this->practitioner->meta->tipeDokter,
|
||||
|
||||
];
|
||||
|
||||
return $doctor;
|
||||
}
|
||||
}
|
||||
31
Modules/Internal/Transformers/OrganizationResource.php
Normal file
31
Modules/Internal/Transformers/OrganizationResource.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Internal\Transformers;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class OrganizationResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
$organization = [
|
||||
'name' => $this->name,
|
||||
'type' => $this->type,
|
||||
'code' => $this->code,
|
||||
'description' => $this->description,
|
||||
'kodeRs' => $this->meta->kodeRs ?? null,
|
||||
'phone' => $this->meta->phone ?? null,
|
||||
'lat' => $this->currentAddress->lat ?? null,
|
||||
'lng' => $this->currentAddress->lng ?? null,
|
||||
'address' => $this->currentAddress ?? null,
|
||||
];
|
||||
|
||||
return $organization;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user