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) ->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL, Invoice::STATUS_PAID]) ->sum('amount'); return $this->render('dashboard.index', [ 'total_invoices' => $total_invoices, ]); } }