27 lines
877 B
PHP
27 lines
877 B
PHP
<?php
|
|
|
|
namespace Modules\MembershipApplication\Transformers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class MembershipApplicationListResource extends JsonResource
|
|
{
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'application_number' => $this->application_number,
|
|
'status' => $this->status?->value ?? $this->status,
|
|
'board_result' => $this->board_result ?: null,
|
|
'submitted_at' => $this->submitted_at,
|
|
'applicant' => $this->whenLoaded('applicant', fn () => [
|
|
'name' => $this->applicant->name,
|
|
'email' => $this->applicant->email,
|
|
'ic_number' => $this->applicant->ic_number,
|
|
]),
|
|
'created_at' => $this->created_at?->toISOString(),
|
|
];
|
|
}
|
|
}
|