mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
32 lines
1.0 KiB
PHP
32 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Carbon\Carbon;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class BankStatementDetailResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource collection into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
$transaction = $this->transaction;
|
|
$accountStatement = $transaction->statement;
|
|
return [
|
|
'id' => $this->id,
|
|
'date' => Carbon::parse($transaction->posting_date)->format('Y-m-d'),
|
|
'transaction_description_1' => $transaction->transaction_description,
|
|
'pay_for' => $transaction->transaction_description_2,
|
|
'system_references' => $this->system,
|
|
'amount' => $transaction->amount,
|
|
'account_statement_date_from' => Carbon::parse($accountStatement->date_from)->format('Y-m-d'),
|
|
'account_statement_date_to' => Carbon::parse($accountStatement->date_to)->format('Y-m-d'),
|
|
];
|
|
}
|
|
}
|