From 3b5190326abd7e78b92eb8554c5f605476c2521b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Tue, 26 Mar 2024 17:11:24 +0100 Subject: [PATCH 1/2] Check for controller redirect --- app/Http/Controllers/ClientPortal/DashboardController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/ClientPortal/DashboardController.php b/app/Http/Controllers/ClientPortal/DashboardController.php index ca5e8825b1b3..a4dec2b74f8f 100644 --- a/app/Http/Controllers/ClientPortal/DashboardController.php +++ b/app/Http/Controllers/ClientPortal/DashboardController.php @@ -17,8 +17,12 @@ use App\Models\Invoice; class DashboardController extends Controller { - public function index(): \Illuminate\View\View + public function index(): \Illuminate\View\View|\Illuminate\Http\RedirectResponse { + if (auth()->guard('contact')->user()->client->getSetting('enable_client_portal_dashboard') === false) { + return redirect()->route('client.invoices.index'); + } + $total_invoices = Invoice::withTrashed() ->where('client_id', auth()->guard('contact')->user()->client_id) ->where('is_deleted', 0) From 626144e62571bacc807d75d0cc2fe1924f12780a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Tue, 26 Mar 2024 17:11:29 +0100 Subject: [PATCH 2/2] Hide from sidebar --- app/Http/ViewComposers/PortalComposer.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Http/ViewComposers/PortalComposer.php b/app/Http/ViewComposers/PortalComposer.php index 4bec30aeaf97..fdcdd9207e1a 100644 --- a/app/Http/ViewComposers/PortalComposer.php +++ b/app/Http/ViewComposers/PortalComposer.php @@ -101,7 +101,9 @@ class PortalComposer $enabled_modules = auth()->guard('contact')->user()->company->enabled_modules; $data = []; - $data[] = [ 'title' => ctrans('texts.dashboard'), 'url' => 'client.dashboard', 'icon' => 'activity']; + if ($this->settings->enable_client_portal_dashboard) { + $data[] = [ 'title' => ctrans('texts.dashboard'), 'url' => 'client.dashboard', 'icon' => 'activity']; + } if (self::MODULE_INVOICES & $enabled_modules) { $data[] = ['title' => ctrans('texts.invoices'), 'url' => 'client.invoices.index', 'icon' => 'file-text'];