Merge pull request #9405 from beganovich/1349-client-dashboard-2

Control client dashboard using setting
This commit is contained in:
David Bomba 2024-03-27 10:24:30 +11:00 committed by GitHub
commit db35429234
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View File

@ -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)

View File

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