redoing logic

This commit is contained in:
Godfrey M 2023-09-19 17:46:29 -07:00
parent 439c2e095d
commit 66abf8d5c0

View file

@ -22,8 +22,11 @@ class SlackSettingsForm extends Component
public Setting $setting; public Setting $setting;
public $webhook_endpoint_rules;
protected $rules = [ protected $rules = [
'webhook_endpoint' => 'url|required_with:webhook_channel|starts_with:https://hooks.slack.com/services|nullable', 'webhook_endpoint' => 'url|required_with:webhook_channel|starts_with:http://,https://,ftp://,irc://|nullable',
'webhook_channel' => 'required_with:webhook_endpoint|starts_with:#|nullable', 'webhook_channel' => 'required_with:webhook_endpoint|starts_with:#|nullable',
'webhook_botname' => 'string|nullable', 'webhook_botname' => 'string|nullable',
]; ];
@ -65,9 +68,8 @@ class SlackSettingsForm extends Component
} }
public function updated($field) { public function updated($field) {
if($this->webhook_selected != 'general') {
$this->validateOnly($field, $this->rules); $this->validateOnly($field, $this->rules);
}
} }
public function updatedWebhookSelected() { public function updatedWebhookSelected() {