mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 12:33:56 +00:00
5940fd16b0
Currency Converter Logic Class
33 lines
884 B
PHP
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,
|
|
];
|
|
}
|
|
}
|