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

29 lines
810 B
PHP

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