authorize('manageOwnProfile', Customer::class); return view('fo.customer.dashboard'); } public function editInfos(GetCrmCustomerQuery $getCrmCustomerQuery): View { $this->authorize('manageOwnProfile', Customer::class); $output = $this->executor->execute( $getCrmCustomerQuery, new GetCrmCustomerQueryInput() ); abort_unless( $output->customer instanceof CrmCustomer, 503, trans('An error occurred, please try again later.') ); return view('fo.customer.edit.infos', [ 'crmCustomer' => $output->customer, ]); } public function editInfosSubmit(UpdateInfosRequest $request, UpdateCustomer $updateCustomer): RedirectResponse { $this->authorize('manageOwnProfile', Customer::class); $output = $this->executor->execute( $updateCustomer, $request->toUpdateCustomerInput() ); return match (true) { $output->result instanceof CrmCustomer => back() ->with('success', trans('Your information has been saved.')), $output->result instanceof ValidationException => back() ->withInput() ->withErrors($output->result->getMessage()), default => back() ->withInput() ->withErrors(trans('An error occurred, please try again later.')), }; } }