do not use Rule (deprecated), changed to Validate

This commit is contained in:
Andras Bacsai
2024-11-05 09:36:40 +01:00
parent d24d1394f7
commit 9b578b2003
26 changed files with 201 additions and 198 deletions

View File

@@ -4,35 +4,35 @@ namespace App\Livewire\Notifications;
use App\Models\Team;
use App\Notifications\Test;
use Livewire\Attributes\Rule;
use Livewire\Attributes\Validate;
use Livewire\Component;
class Discord extends Component
{
public Team $team;
#[Rule(['boolean'])]
#[Validate(['boolean'])]
public bool $discordEnabled = false;
#[Rule(['url', 'nullable'])]
#[Validate(['url', 'nullable'])]
public ?string $discordWebhookUrl = null;
#[Rule(['boolean'])]
#[Validate(['boolean'])]
public bool $discordNotificationsTest = false;
#[Rule(['boolean'])]
#[Validate(['boolean'])]
public bool $discordNotificationsDeployments = false;
#[Rule(['boolean'])]
#[Validate(['boolean'])]
public bool $discordNotificationsStatusChanges = false;
#[Rule(['boolean'])]
#[Validate(['boolean'])]
public bool $discordNotificationsDatabaseBackups = false;
#[Rule(['boolean'])]
#[Validate(['boolean'])]
public bool $discordNotificationsScheduledTasks = false;
#[Rule(['boolean'])]
#[Validate(['boolean'])]
public bool $discordNotificationsServerDiskUsage = false;
public function mount()

View File

@@ -5,6 +5,7 @@ namespace App\Livewire\Notifications;
use App\Models\Team;
use App\Notifications\Test;
use Illuminate\Support\Facades\RateLimiter;
use Livewire\Attributes\Validate;
use Livewire\Component;
class Email extends Component
@@ -15,6 +16,9 @@ class Email extends Component
public bool $sharedEmailEnabled = false;
#[Validate(['boolean'])]
public bool $smtpEnabled = false;
protected $rules = [
'team.smtp_enabled' => 'nullable|boolean',
'team.smtp_from_address' => 'required|email',

View File

@@ -4,53 +4,53 @@ namespace App\Livewire\Notifications;
use App\Models\Team;
use App\Notifications\Test;
use Livewire\Attributes\Rule;
use Livewire\Attributes\Validate;
use Livewire\Component;
class Telegram extends Component
{
public Team $team;
#[Rule(['boolean'])]
#[Validate(['boolean'])]
public bool $telegramEnabled = false;
#[Rule(['nullable', 'string'])]
#[Validate(['nullable', 'string'])]
public ?string $telegramToken = null;
#[Rule(['nullable', 'string'])]
#[Validate(['nullable', 'string'])]
public ?string $telegramChatId = null;
#[Rule(['boolean'])]
#[Validate(['boolean'])]
public bool $telegramNotificationsTest = false;
#[Rule(['boolean'])]
#[Validate(['boolean'])]
public bool $telegramNotificationsDeployments = false;
#[Rule(['boolean'])]
#[Validate(['boolean'])]
public bool $telegramNotificationsStatusChanges = false;
#[Rule(['boolean'])]
#[Validate(['boolean'])]
public bool $telegramNotificationsDatabaseBackups = false;
#[Rule(['boolean'])]
#[Validate(['boolean'])]
public bool $telegramNotificationsScheduledTasks = false;
#[Rule(['nullable', 'string'])]
#[Validate(['nullable', 'string'])]
public ?string $telegramNotificationsTestMessageThreadId = null;
#[Rule(['nullable', 'string'])]
#[Validate(['nullable', 'string'])]
public ?string $telegramNotificationsDeploymentsMessageThreadId = null;
#[Rule(['nullable', 'string'])]
#[Validate(['nullable', 'string'])]
public ?string $telegramNotificationsStatusChangesMessageThreadId = null;
#[Rule(['nullable', 'string'])]
#[Validate(['nullable', 'string'])]
public ?string $telegramNotificationsDatabaseBackupsMessageThreadId = null;
#[Rule(['nullable', 'string'])]
#[Validate(['nullable', 'string'])]
public ?string $telegramNotificationsScheduledTasksThreadId = null;
#[Rule(['boolean'])]
#[Validate(['boolean'])]
public bool $telegramNotificationsServerDiskUsage = false;
public function mount()