fixed #1450
This commit is contained in:
@ -4,6 +4,7 @@ namespace App\Http\Controllers\Settings;
|
||||
|
||||
use App\Abstracts\Http\Controller;
|
||||
use App\Models\Setting\Setting;
|
||||
use App\Utilities\Modules as Utility;
|
||||
use App\Http\Requests\Setting\Module as Request;
|
||||
|
||||
class Modules extends Controller
|
||||
@ -54,9 +55,10 @@ class Modules extends Controller
|
||||
setting()->set($alias . '.' . $key, $value);
|
||||
}
|
||||
|
||||
// Save all settings
|
||||
setting()->save();
|
||||
|
||||
Utility::clearPaymentMethodsCache();
|
||||
|
||||
$message = trans('messages.success.updated', ['type' => trans_choice('general.settings', 2)]);
|
||||
|
||||
$response = [
|
||||
|
@ -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 = [];
|
||||
|
Reference in New Issue
Block a user