<?php
namespace WpBookingHotelAdmin\app\models;
defined('_WPBOOKINGHOTEL_EXEC') or die;

use WpBookingHotel\Factory;
use WpBookingHotel\Mvc\Model\ModelForm;
use WpBookingHotel\Form\Form;
use WpBookingHotel\Mvc\Model\ModelList;
use WpBookingHotel\Registry\Registry;
use WpBookingHotel\Utilities\Utility;

class CurrencyModel extends ModelForm
{
    /**
     * @var string
     */
    public $context = "currency";
    /**
     * @var string
     */
    public $table_name = "currency";

    public function format_currency($based = "USD"){
        $db=$this->_db;
        $query=$db->getQuery(true);
        $query->select('currency.symbol')
            ->from($this->getTableName('currency').' AS currency')
            ->where('currency.code='.$query->quote($based));
        $code = $this->_db->setQuery($query)->loadObject();
        return $code;
    }
}
