diff --git a/app/Http/Livewire/SlackSettingsForm.php b/app/Http/Livewire/SlackSettingsForm.php index 63b9383a9..ddc38f36b 100644 --- a/app/Http/Livewire/SlackSettingsForm.php +++ b/app/Http/Livewire/SlackSettingsForm.php @@ -10,6 +10,7 @@ class SlackSettingsForm extends Component public $slack_endpoint; public $slack_channel; public $slack_botname; + public $successMessage; public Setting $setting; @@ -41,13 +42,17 @@ class SlackSettingsForm extends Component public function submit() { - dd("we here now"); - - $this->validate(); + $this->validate([ + 'slack_endpoint' => 'url|required_with:slack_channel|starts_with:https://hooks.slack.com/|nullable', + 'slack_channel' => 'required_with:slack_endpoint|starts_with:#|nullable', + 'slack_botname' => 'string|nullable', + ]); $this->setting->slack_endpoint = $this->slack_endpoint; $this->setting->slack_channel = $this->slack_channel; $this->setting->slack_botname = $this->slack_botname; + $this->successMessage= trans('admin/settings/message.update.success'); + } } diff --git a/app/Models/Setting.php b/app/Models/Setting.php index f2a418417..828926064 100755 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -83,6 +83,9 @@ class Setting extends Model 'email_domain', 'email_format', 'username_format', + 'slack_endpoint', + 'slack_channel', + 'slack_botname', ]; /** diff --git a/resources/views/livewire/slack-settings-form.blade.php b/resources/views/livewire/slack-settings-form.blade.php index a42a99fd7..5d41ff2a6 100644 --- a/resources/views/livewire/slack-settings-form.blade.php +++ b/resources/views/livewire/slack-settings-form.blade.php @@ -1,65 +1,85 @@