mirror of
https://github.com/Cybrarist/Discount-Bandit.git
synced 2026-11-24 19:49:54 +01:00
- fix multiple prices methods to be more efficient. - fix product stores crashing for list and show. - clear stores cache when products are changed.
23 lines
440 B
PHP
23 lines
440 B
PHP
<?php
|
|
|
|
namespace App\Helpers;
|
|
|
|
use App\Models\Currency;
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
|
class CurrencyHelper
|
|
{
|
|
public static function get_currencies($currency_id=null){
|
|
|
|
$currencies= Cache::remember('currencies', 86400, function() {
|
|
return Currency::pluck("code", "id")->toArray();
|
|
});
|
|
|
|
if ($currency_id)
|
|
return $currencies[$currency_id];
|
|
|
|
return $currencies;
|
|
}
|
|
|
|
}
|