Files
aso/Modules/Linksehat/Transformers/Doctor/DoctorResource.php
2023-07-03 11:39:08 +07:00

28 lines
707 B
PHP

<?php
namespace Modules\Linksehat\Transformers\Doctor;
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)
{
return [
'id' => $this->practitioner_id,
'name' => $this->person->name ?? '',
'specialities' => "Spesialis " . $this->speciality->name ?? '',
'photos' => [
'title' => 'doctors-avatar-' . $this->practitioner_id,
'url' => asset('images/default-doctor-avatar.png')
]
];
}
}