public function run()
 {
     Currency::create(['name' => 'U.S. Dollar', 'currency_code' => 'USD', 'currency_symbol' => '$', 'decimal_point' => '.', 'thousand_separator' => ',', 'place_symbol_before' => true, 'is_enabled' => true, 'is_primary' => true]);
     Currency::create(['name' => 'Euro', 'currency_code' => 'EUR', 'currency_symbol' => '€', 'decimal_point' => '.', 'thousand_separator' => ',', 'place_symbol_before' => true, 'is_enabled' => true, 'is_primary' => false]);
     Currency::create(['name' => 'Pound Sterling', 'currency_code' => 'GBP', 'currency_symbol' => '£', 'decimal_point' => '.', 'thousand_separator' => ',', 'place_symbol_before' => true, 'is_enabled' => true, 'is_primary' => false]);
     Currency::create(['name' => 'Australian Dollar', 'currency_code' => 'AUD', 'currency_symbol' => '$', 'decimal_point' => '.', 'thousand_separator' => ',', 'place_symbol_before' => true, 'is_enabled' => true, 'is_primary' => false]);
 }
Example #2
0
 public function onDisableCurrencies()
 {
     $enable = post('enable', false);
     if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) {
         foreach ($checkedIds as $objectId) {
             if (!($object = CurrencyModel::find($objectId))) {
                 continue;
             }
             $object->is_enabled = $enable;
             $object->save();
         }
     }
     if ($enable) {
         Flash::success(Lang::get('responsiv.currency::lang.currency.enable_success'));
     } else {
         Flash::success(Lang::get('responsiv.currency::lang.currency.disable_success'));
     }
     return Backend::redirect('responsiv/currency/currencies');
 }
Example #3
0
 public function preview($recordId = null, $context = null)
 {
     $this->bodyClass = 'slim-container';
     $this->vars['currency'] = CurrencyModel::getPrimary();
     return $this->asExtension('FormController')->preview($recordId, $context);
 }
Example #4
0
 public function primaryCode()
 {
     return CurrencyModel::getPrimary()->currency_code;
 }
Example #5
0
 /**
  * Returns true if the supplied currency is valid.
  * @return boolean
  */
 public static function isValid($currency)
 {
     $currencies = array_keys(Currency::listEnabled());
     return in_array($currency, $currencies);
 }