gurl_o/plugins/tps/birzha/classes/TransactionResource.php

28 lines
753 B
PHP

<?php
namespace TPS\Birzha\Classes;
use Illuminate\Http\Resources\Json\JsonResource;
class TransactionResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return [
'id' => $this->id,
'amount' => $this->amount,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
'state_en' => $this->amount > 0 ? 'Replenishment' : 'Withdraw',
'state_ru' => $this->amount > 0 ? 'Пополнение' : 'Снятие',
'state_tm' => $this->amount > 0 ? 'Dolduryldy' : 'Tutuldy',
];
}
}