/** * Show the form for editing the specified resource. * * @return Response */ public function index() { $setting = setting(); $currencies = Country::distinct()->where('currency', '<>', '')->groupBy('currency')->lists('currency')->toArray(); $languages = $this->getLanguages(); return view_backend('setting.index', compact('setting', 'currencies', 'languages')); }
/** * Get maps by status. * * @param $status * * @return array */ public function getByStatus($status) { $maps = []; $enabled = Country::enabled()->lists('code')->toArray(); foreach ($this->all() as $code => $map) { if (in_array($code, $enabled) === $status) { $maps[$code] = $map; } } return $maps; }
/** * Display a listing of the resource. * * @return Response */ public function index() { $gateways = Gateway::paginate(10); $currencies = Country::distinct()->where('currency', '<>', '')->groupBy('currency')->lists('currency')->toArray(); return view_backend('gateway.index', compact('gateways', 'currencies')); }
/** * Update country currency symbole. * * @param CountryUpdateSymboleRequest $request * @param Country $country * * @return Response */ public function updateSymbole(CountryUpdateSymboleRequest $request, Country $country) { $country->currency_symbole = $request->symbole; $country->save(); }
/** * Run the database seeds. * * @return void */ public function run() { $countries = $this->getCountries(); Country::insert($countries); }
/** * Determine whether the given status same with the current module status. * * @param $status * * @return bool */ public function isStatus($status) { return (bool) Country::whereCode($this->getCode())->whereIsActivate($status)->count(); }
/** * Get ad currency. * * @param Ad $ad * @param string $unit * * @return string */ function getAdCurrency($ad, $unit) { if ($unit != '{currency}') { return $unit; } $default = setting('default_ad_currency'); $countryCode = $ad->geolocation->country; if (!$countryCode) { return $default; } $country = Country::whereCode($countryCode)->first(); if ($country) { return $country->currency_symbole ?: $country->currency; } return $default; }