checkAuth()) { return $this->renderForLoggedInUser($request); } return redirect()->intended('/login'); } private function renderForLoggedInUser(Request $request) { $authCheckProvider = new AuthCheckProvider; $inertiaProvider = new InertiaProvider('Dashboard/Dashboard', [ 'myInvoices' => $this->invoices->getMyInvoicesWidget() ]); return $inertiaProvider->render(); } private function renderForGuest(Request $request) { } public function getMyInvoices() : JsonResponse { $invoices = $this->invoices->getMyInvoicesWidget(); return response()->json(['myInvoices' => $invoices]); } public function getOpenCostUnits() : JsonResponse { $costUnits = $this->costUnits->listForSummary(5); return response()->json(['openCostUnits' => $costUnits]); } }