Files
YNWA Fawzy cb4da09299 - remove stores from query in product resource and replace it with cached
- fix multiple prices methods to be more efficient.
- fix product stores crashing for list and show.
- clear stores cache when products are changed.
2024-07-26 10:18:57 +04:00

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;
}
}