Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
gilour
/
app
/
Models
:
Transaction.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class Transaction extends Model { protected $table = "transactions"; protected $guarded = ["id"]; public static function convertAmount($amount, $fromCurrency) { $currencyConversion = file_get_contents("currency.json");; $jsonData = json_decode($currencyConversion); $value = round(($amount / ($jsonData->rates->$fromCurrency)), 0); return $value; } }