'domains/channel/field.client.credentials', 'credentials.username' => 'domains/channel/field.client.credentials.username', 'credentials.password' => 'domains/channel/field.client.credentials.password', 'credentials.token' => 'domains/channel/field.client.credentials.token', ])] public array $credentials = []; #[Validate('required|max:255', as: 'domains/channel/field.client.webhook')] public string $webhook = ''; public function updatedAuthType(): void { $this->reset('credentials'); } public function rules(): array { if ($this->auth_type === AuthType::BEARER) { return [ 'credentials.token' => 'required', ]; } if ($this->auth_type == AuthType::BASIC) { return [ 'credentials.username' => 'required', 'credentials.password' => 'required', ]; } return []; } }