25 lines
753 B
PHP
25 lines
753 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources\Client;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class WalletTransactionResource extends JsonResource
|
|
{
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'type' => $this->type,
|
|
'reason' => $this->reason,
|
|
'amount' => $this->amount,
|
|
'balance_after' => $this->balance_after,
|
|
'description' => $this->description,
|
|
'via_gateway' => $this->payment_id !== null,
|
|
'invoice_number' => $this->whenLoaded('invoice', fn () => $this->invoice?->number),
|
|
'created_at' => verta($this->created_at)->format('%Y/%m/%d - H:i'),
|
|
];
|
|
}
|
|
}
|