From 6bb5aab462da3fe673e410944a15acfe05ff9258 Mon Sep 17 00:00:00 2001 From: cuneytsenturk Date: Sat, 5 May 2018 13:09:48 +0300 Subject: [PATCH] close #328 Fixed: Loading wrong offline payment method --- app/Utilities/Modules.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/Utilities/Modules.php b/app/Utilities/Modules.php index f36adb8ce..f5495c2f4 100644 --- a/app/Utilities/Modules.php +++ b/app/Utilities/Modules.php @@ -13,13 +13,17 @@ class Modules 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; if ($customer && $type != 'all') { - $payment_methods = Cache::get('payment_methods.customer'); + $payment_methods = Cache::get($cache_customer); } if (!empty($payment_methods)) { @@ -61,9 +65,9 @@ class Modules } if ($customer) { - Cache::put('payment_methods.customer', $payment_methods, Date::now()->addHour(6)); + Cache::put($cache_customer, $payment_methods, Date::now()->addHour(6)); } 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 : [];