Skip to content

Commit d84d0a8

Browse files
committed
chore: Refactor DatabaseBackupJob to handle missing team
1 parent 0da31c3 commit d84d0a8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/Jobs/DatabaseBackupJob.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ public function __construct($backup)
6666
public function handle(): void
6767
{
6868
try {
69-
$this->team = Team::findOrFail($this->backup->team_id);
69+
$this->team = Team::find($this->backup->team_id);
70+
if (! $this->team) {
71+
$this->backup->delete();
72+
73+
return;
74+
}
7075
if (data_get($this->backup, 'database_type') === 'App\Models\ServiceDatabase') {
7176
$this->database = data_get($this->backup, 'database');
7277
$this->server = $this->database->service->server;

0 commit comments

Comments
 (0)