migrants-nt-sec/app/Http/Resources/FamilyResource.php

27 lines
689 B
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class FamilyResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return $this->resource ? [
'family_id' => $this->family_id,
'person_id' => $this->person_id,
'names_of_parents' => $this->names_of_parents,
'names_of_children' => $this->names_of_children,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
] : null;
}
}