Files
exchange-2.0/app/Http/Resources/RateCalculateCurrencyResource.php
T
CheeSiong 5940fd16b0 ListCurrencyLogicClass
Currency Converter Logic Class
2020-12-02 17:31:00 +08:00

33 lines
884 B
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
use App\Models\Currency;
class RateCalculateCurrencyResource extends JsonResource
{
public function __construct(Currency $conversion_currency, Currency $convertable_currency, $convert_amount)
{
$this->conversion_currency = $conversion_currency;
$this->convertable_currency = $convertable_currency;
$this->convert_amount = $convert_amount;
}
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return [
'conversion_currency' => $this->conversion_currency->id,
'convertable_currency' => $this->conversion_currency->id,
'convert_amount' => $this->convert_amount,
];
}
}