This commit is contained in:
denisdulici
2020-05-23 15:34:54 +03:00
parent ce14bc5f49
commit 0463291d09
3 changed files with 23 additions and 12 deletions

View File

@ -9,10 +9,8 @@ class Modules
{
public static function getPaymentMethods($type = null)
{
$company_id = session('company_id');
$cache_admin = 'payment_methods.' . $company_id . '.admin';
$cache_customer = 'payment_methods.' . $company_id . '.customer';
$cache_admin = static::getPaymentMethodsCacheKey('admin');
$cache_customer = static::getPaymentMethodsCacheKey('customer');
$payment_methods = Cache::get($cache_admin);
@ -65,6 +63,21 @@ class Modules
return ($payment_methods) ? $payment_methods : [];
}
public static function clearPaymentMethodsCache()
{
Cache::forget(static::getPaymentMethodsCacheKey('admin'));
Cache::forget(static::getPaymentMethodsCacheKey('customer'));
if (config('setting.cache.enabled')) {
Cache::forget(setting()->getCacheKey());
}
}
public static function getPaymentMethodsCacheKey($type)
{
return 'payment_methods.' . session('company_id') . '.' . $type;
}
protected static function sortPaymentMethods(&$list)
{
$sort_order = [];