diff --git a/app/Models/ScheduledDatabaseBackup.php b/app/Models/ScheduledDatabaseBackup.php index ce5d3a87f..3921e32e4 100644 --- a/app/Models/ScheduledDatabaseBackup.php +++ b/app/Models/ScheduledDatabaseBackup.php @@ -39,13 +39,19 @@ class ScheduledDatabaseBackup extends BaseModel public function server() { if ($this->database) { - if ($this->database->destination && $this->database->destination->server) { - $server = $this->database->destination->server; - + if ($this->database instanceof ServiceDatabase) { + $destination = data_get($this->database->service, 'destination'); + $server = data_get($destination, 'server'); + } else { + $destination = data_get($this->database, 'destination'); + $server = data_get($destination, 'server'); + } + if ($server) { return $server; } } + return null; } }