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) 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'];