close #328 Fixed: Loading wrong offline payment method
This commit is contained in:
parent
831653e87a
commit
6bb5aab462
@ -13,13 +13,17 @@ class Modules
|
|||||||
|
|
||||||
public static function getPaymentMethods($type = null)
|
public static function getPaymentMethods($type = null)
|
||||||
{
|
{
|
||||||
|
$company_id = session('company_id');
|
||||||
|
|
||||||
$payment_methods = Cache::get('payment_methods.admin');
|
$cache_admin = 'payment_methods.' . $company_id . '.admin';
|
||||||
|
$cache_customer = 'payment_methods.' . $company_id . '.customer';
|
||||||
|
|
||||||
|
$payment_methods = Cache::get($cache_admin);
|
||||||
|
|
||||||
$customer = auth()->user()->customer;
|
$customer = auth()->user()->customer;
|
||||||
|
|
||||||
if ($customer && $type != 'all') {
|
if ($customer && $type != 'all') {
|
||||||
$payment_methods = Cache::get('payment_methods.customer');
|
$payment_methods = Cache::get($cache_customer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($payment_methods)) {
|
if (!empty($payment_methods)) {
|
||||||
@ -61,9 +65,9 @@ class Modules
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($customer) {
|
if ($customer) {
|
||||||
Cache::put('payment_methods.customer', $payment_methods, Date::now()->addHour(6));
|
Cache::put($cache_customer, $payment_methods, Date::now()->addHour(6));
|
||||||
} else {
|
} else {
|
||||||
Cache::put('payment_methods.admin', $payment_methods, Date::now()->addHour(6));
|
Cache::put($cache_admin, $payment_methods, Date::now()->addHour(6));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ($payment_methods) ? $payment_methods : [];
|
return ($payment_methods) ? $payment_methods : [];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user