add logic

This commit is contained in:
ayntk-ai committed 2024-08-16 16:01:41 +02:00
1 parent d906bb2381
commit dab5f0fe09
4 files changed
+97 -44

No files matched your search

+19 -1
View File
@@ -34,4 +34,22 @@ class ScheduledDatabaseBackup extends BaseModel
{
return $this->hasMany(ScheduledDatabaseBackupExecution::class)->where('created_at', '>=', now()->subDays($days))->get();
}
}
public function server()
{
$database = $this->database;
if (!$database) {
return null;
}
if (method_exists($database, 'server')) {
return $database->server;
}
if (method_exists($database, 'service') && $database->service) {
return $database->service->server;
}
return null;
}
}
+13 -1
View File
@@ -28,4 +28,16 @@ class ScheduledTask extends BaseModel
{
return $this->hasMany(ScheduledTaskExecution::class);
}
}
public function server()
{
if ($this->application) {
return $this->application->server;
} elseif ($this->database) {
return $this->database->server;
} elseif ($this->service) {
return $this->service->server;
}
return null;
}
}