authorize('customers.use'); if ($customer === null) { return; } $summary = $customerQueries->findSummary($customer); abort_if($summary === null, 404); $this->customerId = $summary->id; $this->form->fillFromSummary($summary); } public function save(RegisterCustomer $registerCustomer, UpdateCustomer $updateCustomer): void { $this->authorize('customers.use'); $data = $this->form->toData(); try { if ($this->customerId === null) { $registerCustomer->execute($data); session()->flash('status', __('customers.created', ['name' => $data->name])); } else { $updateCustomer->execute($this->customerId, $data); session()->flash('status', __('customers.updated', ['name' => $data->name])); } } catch (CustomerNotFound) { abort(404); } catch (DomainException $exception) { $this->form->showDomainError($exception); return; } $this->redirectRoute('customers.index', navigate: true); } public function render(): mixed { return $this->view()->title(__($this->customerId === null ? 'customers.create_title' : 'customers.edit_title')); } }; ?>

{{ __($customerId === null ? 'customers.create_title' : 'customers.edit_title') }}

@if ($form->type === CustomerType::Company->value) {{-- No inputmode="numeric": the iOS number pad has no hyphen for 1234567-8. --}} @endif