route('page'); if (! $page instanceof PreregistrationPage) { return false; } return $this->user()?->can('update', $page) ?? false; } /** * @return array> */ public function rules(): array { /** @var PreregistrationPage $page */ $page = $this->route('page'); return [ 'api_key' => [ Rule::requiredIf(fn (): bool => $page->mailwizzConfig === null), 'nullable', 'string', 'max:512', ], 'list_uid' => ['required', 'string', 'max:255'], 'list_name' => ['nullable', 'string', 'max:255'], 'field_email' => ['required', 'string', 'max:255'], 'field_first_name' => ['required', 'string', 'max:255'], 'field_last_name' => ['required', 'string', 'max:255'], 'field_phone' => ['nullable', 'string', 'max:255'], 'field_coupon_code' => ['nullable', 'string', 'max:255'], 'tag_field' => ['required', 'string', 'max:255'], 'tag_value' => ['required', 'string', 'max:255'], ]; } }