api person create & update & add family

This commit is contained in:
Muhammad Fajar
2022-11-01 14:41:59 +07:00
parent a34fb34180
commit ba0023544f
10 changed files with 345 additions and 132 deletions

View File

@@ -0,0 +1,40 @@
<?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,
];
}
}