fix: migrate db schema for smtp + discord

This commit is contained in:
Andras Bacsai
2023-07-27 21:26:15 +02:00
parent d0a85713d2
commit 9c393ff6bc
21 changed files with 382 additions and 238 deletions

View File

@@ -10,26 +10,28 @@ class DiscordSettings extends Component
{
public Team $model;
protected $rules = [
'model.discord.enabled' => 'nullable|boolean',
'model.discord.webhook_url' => 'required|url',
'model.discord_notifications.test' => 'nullable|boolean',
'model.discord_notifications.deployments' => 'nullable|boolean',
'model.discord_notifications.status_changes' => 'nullable|boolean',
'model.discord_enabled' => 'nullable|boolean',
'model.discord_webhook_url' => 'required|url',
'model.discord_notifications_test' => 'nullable|boolean',
'model.discord_notifications_deployments' => 'nullable|boolean',
'model.discord_notifications_status_changes' => 'nullable|boolean',
];
protected $validationAttributes = [
'model.discord.webhook_url' => 'Discord Webhook',
'model.discord_webhook_url' => 'Discord Webhook',
];
public function instantSave()
{
try {
$this->submit();
} catch (\Exception $e) {
$this->model->discord->enabled = false;
ray($e->getMessage());
$this->model->discord_enabled = false;
$this->validate();
}
}
public function saveModel()
{
ray($this->model);
$this->model->save();
if (is_a($this->model, Team::class)) {
session(['currentTeam' => $this->model]);
@@ -47,4 +49,4 @@ class DiscordSettings extends Component
$this->model->notify(new TestNotification('discord'));
$this->emit('success', 'Test notification sent.');
}
}
}