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

31 lines
879 B
PHP

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