api person create & update & add family
This commit is contained in:
40
Modules/Linksehat/Transformers/Person/PersonResource.php
Normal file
40
Modules/Linksehat/Transformers/Person/PersonResource.php
Normal 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,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user