authorize('manageOwnProfile', Customer::class); return view('fo.customer.dashboard'); } public function editInfos(): View { $this->authorize('manageOwnProfile', Customer::class); $customer = $this->authService->getCustomerAsMandatory(); $crmCustomer = $this->crmService->getCustomerFromHashCode($customer->hashcode); abort_unless( $crmCustomer instanceof CrmCustomer, 503, trans('An error occurred, please try again later.') ); return view('fo.customer.edit.infos', compact('customer', 'crmCustomer')); } public function editInfosSubmit(UpdateInfosRequest $request): RedirectResponse { $this->authorize('manageOwnProfile', Customer::class); $customer = $this->authService->getCustomerAsMandatory(); try { $result = $this->crmService->updateCustomerInfos( $customer, $request->toCrmData() ); if ($result instanceof CrmCustomer) { return back()->with('success', trans('Your information has been saved.')); } return back() ->withInput() ->withErrors($result->getMessage()); } catch (\Throwable $e) { report($e); return back() ->withInput() ->withErrors(trans('An error occurred, please try again later.')); } } }