From cd070261fcb7ae56b45c1e81e1534d38585626be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Tue, 29 Dec 2020 18:18:53 +0300 Subject: [PATCH] skip type scope in dashboard and reports --- app/Traits/Scopes.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/Traits/Scopes.php b/app/Traits/Scopes.php index 1ffd7fb7c..5d8b46028 100644 --- a/app/Traits/Scopes.php +++ b/app/Traits/Scopes.php @@ -71,7 +71,15 @@ trait Scopes public function getTypeFromRequest() { - $type = request()->get('type') ?: Str::singular((string) request()->segment(2)); + $type = ''; + $request = request(); + + // Skip type scope in dashboard and reports + if ($request->routeIs('dashboards.*') || $request->routeIs('reports.*')) { + return $type; + } + + $type = $request->get('type') ?: Str::singular((string) $request->segment(2)); if ($type == 'revenue') { $type = 'income';