Add API
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Linksehat\Transformers;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class PractitionerRoleToDoctorResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'full_name' => $this->practitioner->person->full_name,
|
||||
'name_prefix' => $this->practitioner->person->name_prefix,
|
||||
'name' => $this->practitioner->person->name,
|
||||
'name_suffix' => $this->practitioner->person->name_suffix,
|
||||
'gender' => $this->practitioner->person->gender,
|
||||
'speciality_name' => !empty($this->speciality->name ?? null) ? 'Spesialis '. $this->speciality->name : 'Spesialis Empty',
|
||||
'is_online' => false,
|
||||
'price_range' => 'Rp 100.000 - Rp 350.000',
|
||||
'price_start' => '100000',
|
||||
'price_end' => '350000',
|
||||
'avatar_url' => asset('images/default-doctor-avatar.png'),
|
||||
];
|
||||
return parent::toArray($request);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user