30 lines
821 B
PHP
30 lines
821 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class ResidenceResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return $this->resource ? [
|
|
'residence_id' => $this->residence_id,
|
|
'person_id' => $this->person_id,
|
|
'darwin' => $this->darwin,
|
|
'katherine' => $this->katherine,
|
|
'tennant_creek' => $this->tennant_creek,
|
|
'alice_springs' => $this->alice_springs,
|
|
'home_at_death' => $this->home_at_death,
|
|
'created_at' => $this->created_at,
|
|
'updated_at' => $this->updated_at,
|
|
] : null;
|
|
}
|
|
}
|