selectedBackupId) { $this->setSelectedBackup($this->selectedBackupId); } $this->parameters = get_route_parameters(); if ($this->database->getMorphClass() === 'App\Models\ServiceDatabase') { $this->type = 'service-database'; } else { $this->type = 'database'; } } public function setSelectedBackup($backupId) { $this->selectedBackupId = $backupId; $this->selectedBackup = $this->database->scheduledBackups->find($this->selectedBackupId); if (is_null($this->selectedBackup)) { $this->selectedBackupId = null; } } public function delete($scheduled_backup_id): void { $this->database->scheduledBackups->find($scheduled_backup_id)->delete(); $this->emit('success', 'Scheduled backup deleted successfully.'); $this->refreshScheduledBackups(); } public function refreshScheduledBackups(?int $id = null): void { $this->database->refresh(); if ($id) { $this->setSelectedBackup($id); } } }