Files
aso/Modules/Linksehat/Transformers/Person/PersonResource.php
2022-11-01 14:41:59 +07:00

41 lines
1.2 KiB
PHP

<?php
namespace Modules\Linksehat\Transformers\Person;
use App\Helpers\Helper;
use Illuminate\Http\Resources\Json\JsonResource;
class PersonResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request
* @return array
*/
public function toArray($request)
{
return [
'avatar' => [
'title' => $this->avatar->name ?? '',
'url' => url($this->avatar->path) ?? '',
],
'id' => $this->id,
'name' => $this->name,
'birth_place' => $this->birth_place,
'gender' => $this->gender,
'phone' => $this->phone,
'email' => $this->email,
'blood_type' => $this->blood_type,
'weight' => $this->weight,
'height' => $this->height,
'relation_with_owner' => $this->relation_with_owner,
'marital_status' => $this->marital_status,
'last_education' => $this->last_education,
'current_employment' => $this->current_employment,
'nik' => $this->nik,
'religion' => $this->religion,
];
}
}