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 [ 'client_id' => [ 'sometimes', Rule::requiredIf(fn (): bool => $page->weeztixConfig === null), 'nullable', 'string', 'max:2048', ], 'client_secret' => [ 'sometimes', Rule::requiredIf(fn (): bool => $page->weeztixConfig === null), 'nullable', 'string', 'max:2048', ], 'company_guid' => ['nullable', 'string', 'max:255'], 'company_name' => ['nullable', 'string', 'max:255'], 'coupon_guid' => ['nullable', 'string', 'max:255'], 'coupon_name' => ['nullable', 'string', 'max:255'], 'code_prefix' => ['nullable', 'string', 'max:32'], 'usage_count' => ['nullable', 'integer', 'min:1', 'max:99999'], ]; } }