diff --git a/app/Livewire/Notifications/Discord.php b/app/Livewire/Notifications/Discord.php index 469e47605c..46f6739833 100644 --- a/app/Livewire/Notifications/Discord.php +++ b/app/Livewire/Notifications/Discord.php @@ -22,7 +22,7 @@ class Discord extends Component #[Validate(['boolean'])] public bool $discordEnabled = false; - #[Validate(['nullable', new SafeWebhookUrl])] + #[Validate(['required_if:discordEnabled,true', 'nullable', new SafeWebhookUrl])] public ?string $discordWebhookUrl = null; #[Validate(['boolean'])] diff --git a/app/Livewire/Notifications/Pushover.php b/app/Livewire/Notifications/Pushover.php index a2fe63a0f8..ee09cc7393 100644 --- a/app/Livewire/Notifications/Pushover.php +++ b/app/Livewire/Notifications/Pushover.php @@ -26,10 +26,10 @@ class Pushover extends Component #[Validate(['boolean'])] public bool $pushoverEnabled = false; - #[Validate(['nullable', 'string'])] + #[Validate(['required_if:pushoverEnabled,true', 'nullable', 'string'])] public ?string $pushoverUserKey = null; - #[Validate(['nullable', 'string'])] + #[Validate(['required_if:pushoverEnabled,true', 'nullable', 'string'])] public ?string $pushoverApiToken = null; #[Validate(['boolean'])] diff --git a/app/Livewire/Notifications/Slack.php b/app/Livewire/Notifications/Slack.php index 70ec6f786e..2a6fbfbb55 100644 --- a/app/Livewire/Notifications/Slack.php +++ b/app/Livewire/Notifications/Slack.php @@ -27,7 +27,7 @@ class Slack extends Component #[Validate(['boolean'])] public bool $slackEnabled = false; - #[Validate(['nullable', new SafeWebhookUrl])] + #[Validate(['required_if:slackEnabled,true', 'nullable', new SafeWebhookUrl])] public ?string $slackWebhookUrl = null; #[Validate(['boolean'])] diff --git a/app/Livewire/Notifications/Telegram.php b/app/Livewire/Notifications/Telegram.php index f6edb89d3e..f45bc9045c 100644 --- a/app/Livewire/Notifications/Telegram.php +++ b/app/Livewire/Notifications/Telegram.php @@ -27,10 +27,10 @@ class Telegram extends Component #[Validate(['boolean'])] public bool $telegramEnabled = false; - #[Validate(['nullable', 'string'])] + #[Validate(['required_if:telegramEnabled,true', 'nullable', 'string'])] public ?string $telegramToken = null; - #[Validate(['nullable', 'string'])] + #[Validate(['required_if:telegramEnabled,true', 'nullable', 'string'])] public ?string $telegramChatId = null; #[Validate(['boolean'])] diff --git a/app/Livewire/Notifications/Webhook.php b/app/Livewire/Notifications/Webhook.php index 9b20695cc7..e382ee4394 100644 --- a/app/Livewire/Notifications/Webhook.php +++ b/app/Livewire/Notifications/Webhook.php @@ -22,7 +22,7 @@ class Webhook extends Component #[Validate(['boolean'])] public bool $webhookEnabled = false; - #[Validate(['nullable', new SafeWebhookUrl])] + #[Validate(['required_if:webhookEnabled,true', 'nullable', new SafeWebhookUrl])] public ?string $webhookUrl = null; #[Validate(['boolean'])] diff --git a/resources/views/livewire/notifications/discord.blade.php b/resources/views/livewire/notifications/discord.blade.php index 9e3921f514..a372d53fb5 100644 --- a/resources/views/livewire/notifications/discord.blade.php +++ b/resources/views/livewire/notifications/discord.blade.php @@ -25,7 +25,7 @@ ]" />