mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 12:33:56 +00:00
43 lines
2.0 KiB
PHP
43 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class BankStatementTransactionResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
|
|
return [
|
|
'id' => $this->id,
|
|
'account_number' => $this->statement->account->number,
|
|
'account_type' => $this->statement->account->type,
|
|
'account_name' => $this->statement->account->name,
|
|
'account_statement_id' => $this->statement->id,
|
|
'account_statement_date_from' => $this->statement->date_from,
|
|
'account_statement_date_to' => $this->statement->date_to,
|
|
'posting_date' => $this->posting_date->format('d-m-Y g:i A'),
|
|
'amount' => $this->amount,
|
|
'transaction_description_1' => $this->transaction_description,
|
|
'transaction_description_2' => $this->transaction_description_2,
|
|
'transaction_description_3' => $this->transaction_description_3,
|
|
'transaction_description_4' => $this->transaction_description_4,
|
|
'transaction_description_5' => $this->transaction_description_5,
|
|
'owners' => [
|
|
'approved' => BankStatementTransactionOwnerResource::collection($this->owners()->whereIn('status', [ApprovalStatus::APPROVED])->get()),
|
|
'pending_verification' => BankStatementTransactionOwnerResource::collection($this->owners()->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION])->get()),
|
|
'rejected' => BankStatementTransactionOwnerResource::collection($this->owners()->whereIn('status', [ApprovalStatus::REJECTED])->get()),
|
|
'completed' => BankStatementTransactionOwnerResource::collection($this->owners()->whereIn('status', [ApprovalStatus::COMPLETED])->get()),
|
|
]
|
|
];
|
|
}
|
|
}
|