This commit is contained in:
Andras Bacsai
2023-06-01 13:24:20 +02:00
parent 0aa816b4f2
commit 6e094eaf42
10 changed files with 65 additions and 64 deletions

View File

@@ -13,11 +13,11 @@ class DiscordSettings extends Component
public Team|Server $model;
protected $rules = [
'model.smtp_attributes.discord_active' => 'nullable|boolean',
'model.smtp_attributes.discord_webhook' => 'required|url',
'model.extra_attributes.discord_active' => 'nullable|boolean',
'model.extra_attributes.discord_webhook' => 'required|url',
];
protected $validationAttributes = [
'model.smtp_attributes.discord_webhook' => 'Discord Webhook',
'model.extra_attributes.discord_webhook' => 'Discord Webhook',
];
public function mount($model)
{
@@ -28,8 +28,8 @@ class DiscordSettings extends Component
try {
$this->submit();
} catch (\Exception $e) {
$this->model->smtp_attributes->discord_active = false;
$this->addError('model.smtp_attributes.discord_webhook', $e->getMessage());
$this->model->extra_attributes->discord_active = false;
$this->validate();
}
}
private function saveModel()