mirror of
https://gitlab.com/uldvstar/exchange-2.0.git
synced 2026-08-19 20:44:25 +00:00
27 lines
763 B
PHP
27 lines
763 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class CurrencyRateResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
return [
|
|
'payment_method' => PaymentMethodType::PAYMENT_METHODS_ID[$this->payment_method_type],
|
|
'selling' => [
|
|
'type' => property_exists($this->selling, 'type') ? $this->selling->type : 'rate',
|
|
'value' => property_exists($this->selling, 'value') ? $this->selling->value : $this->selling
|
|
]
|
|
];
|
|
}
|
|
}
|