*/ public function rules(): array { /** @var PreregistrationPage $page */ $page = $this->route('publicPage'); return [ 'first_name' => ['required', 'string', 'max:255'], 'last_name' => ['required', 'string', 'max:255'], 'email' => ['required', 'email', 'max:255'], 'phone' => $page->phone_enabled ? ['required', 'string', 'max:20'] : ['nullable', 'string', 'max:20'], ]; } /** * @return array */ public function attributes(): array { return [ 'first_name' => __('First name'), 'last_name' => __('Last name'), 'email' => __('Email'), 'phone' => __('Phone'), ]; } protected function prepareForValidation(): void { $email = $this->input('email'); if (is_string($email)) { $this->merge([ 'email' => strtolower(trim($email)), ]); } } }