예제 #1
0
 /**
  * Formats a money object to price + value. eg Money A becomes KSH 10000
  *
  * @param $money
  *
  * @param bool $returnMoneyObject
  *
  * @return mixed
  */
 function format_money($money, $returnMoneyObject = false)
 {
     if (!$money instanceof Money) {
         $money = new Money(is_int($money) ? $money : (int) $money, new Currency(config('site.currencies.default', 'KES')));
     }
     if ($returnMoneyObject) {
         return $money;
     } else {
         $formatter = new MoneyFormatter();
         return $formatter->format($money);
     }
 }
 /**
  * Formats a money object to price + value. eg Money A becomes KSH 10000
  *
  * @param $money
  *
  * @return mixed
  */
 public function formatMoneyValue($money)
 {
     if (!$money instanceof Money) {
         $money = new Money((int) $money, new Currency($this->defaultCurrency));
     }
     $formatter = new MoneyFormatter();
     return $formatter->format($money);
 }