From fc3f9ff6ccfbb5f9dee9fbde6c4c25746d39968f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Wed, 17 Jun 2020 23:07:31 +0300 Subject: [PATCH 1/2] Apps cache key changes --- app/Traits/Modules.php | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/app/Traits/Modules.php b/app/Traits/Modules.php index be29a8507..f3083528b 100644 --- a/app/Traits/Modules.php +++ b/app/Traits/Modules.php @@ -36,7 +36,7 @@ trait Modules // Get All Modules public function getModules($data = []) { - $key = 'apps.items.page.' . $this->getPageNumber($data); + $key = 'apps.app.' . $this->getDataKey($data); $items = Cache::get($key); @@ -61,7 +61,7 @@ trait Modules public function getDocumentation($alias) { - $key = 'apps.docs.' . $alias; + $key = 'apps.' . $alias . '.docs.' . $this->getDataKey($data); $documentation = Cache::get($key); @@ -78,7 +78,7 @@ trait Modules public function getModuleReviews($alias, $data = []) { - $key = 'apps.' . $alias . '.reviews.page.'. $this->getPageNumber($data); + $key = 'apps.' . $alias . '.reviews.' . $this->getDataKey($data); $reviews = Cache::get($key); @@ -95,7 +95,7 @@ trait Modules public function getCategories($data = []) { - $key = 'apps.categories.page.' . $this->getPageNumber($data); + $key = 'apps.categories.' . $this->getDataKey($data); $categories = Cache::get($key); @@ -112,7 +112,7 @@ trait Modules public function getModulesByCategory($alias, $data = []) { - $key = 'apps.categories.' . $alias . '.page.' . $this->getPageNumber($data); + $key = 'apps.categories.' . $alias . '.' . $this->getDataKey($data); $category = Cache::get($key); @@ -129,7 +129,7 @@ trait Modules public function getVendors($data = []) { - $key = 'apps.vendors.page.' . $this->getPageNumber($data); + $key = 'apps.vendors.' . $this->getDataKey($data); $vendors = Cache::get($key); @@ -146,7 +146,7 @@ trait Modules public function getModulesByVendor($alias, $data = []) { - $key = 'apps.vendors.' . $alias . '.page.' . $this->getPageNumber($data); + $key = 'apps.vendors.' . $alias . '.' . $this->getDataKey($data); $vendor = Cache::get($key); @@ -195,7 +195,7 @@ trait Modules public function getPreSaleModules($data = []) { - $key = 'apps.pre_sale.page.' . $this->getPageNumber($data); + $key = 'apps.pre_sale.' . $this->getDataKey($data); $pre_sale = Cache::get($key); @@ -212,7 +212,7 @@ trait Modules public function getPaidModules($data = []) { - $key = 'apps.paid.page.' . $this->getPageNumber($data); + $key = 'apps.paid.' . $this->getDataKey($data); $paid = Cache::get($key); @@ -229,7 +229,7 @@ trait Modules public function getNewModules($data = []) { - $key = 'apps.new.page.' . $this->getPageNumber($data); + $key = 'apps.new.' . $this->getDataKey($data); $new = Cache::get($key); @@ -246,7 +246,7 @@ trait Modules public function getFreeModules($data = []) { - $key = 'apps.free.page.' . $this->getPageNumber($data); + $key = 'apps.free.' . $this->getDataKey($data); $free = Cache::get($key); @@ -263,7 +263,7 @@ trait Modules public function getFeaturedModules($data = []) { - $key = 'apps.featured.page.' . $this->getPageNumber($data); + $key = 'apps.featured.' . $this->getDataKey($data); $featured = Cache::get($key); @@ -663,4 +663,21 @@ trait Modules return $data['query']['page']; } + + public function getDataKey($data = []) + { + $result = 'language.' . app()->getLocale() . '.page.' . $this->getPageNumber($data); + + if (isset($data['query']['page'])) { + unset($data['query']['page']); + } + + if (isset($data['query'])){ + foreach($data['query'] as $key => $value) { + $result .= '.' . $key . '.' . $value; + } + } + + return $result; + } } From 0140a248d67523ede0197d76b105c5860579a653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Thu, 18 Jun 2020 17:33:55 +0300 Subject: [PATCH 2/2] sort language --- app/Traits/Modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Traits/Modules.php b/app/Traits/Modules.php index f3083528b..5a81573fd 100644 --- a/app/Traits/Modules.php +++ b/app/Traits/Modules.php @@ -666,7 +666,7 @@ trait Modules public function getDataKey($data = []) { - $result = 'language.' . app()->getLocale() . '.page.' . $this->getPageNumber($data); + $result = 'language.' . language()->getShortCode() . '.page.' . $this->getPageNumber($data); if (isset($data['query']['page'])) { unset($data['query']['page']);