task = $task; if ($service = $task->service()->first()) { $this->resource = $service; } else if ($application = $task->application()->first()) { $this->resource = $application; } } public function middleware(): array { return [new WithoutOverlapping($this->task->id)]; } public function uniqueId(): int { return $this->task->id; } public function handle(): void { file_put_contents('/tmp/scheduled-job-run', 'ran in handle'); try { echo($this->resource->type()); file_put_contents('/tmp/scheduled-job-run-'.$this->task->id, $this->task->name); } catch (\Throwable $e) { send_internal_notification('ScheduledTaskJob failed with: ' . $e->getMessage()); throw $e; } finally { // BackupCreated::dispatch($this->team->id); } } private function add_to_backup_output($output): void { if ($this->backup_output) { $this->backup_output = $this->backup_output . "\n" . $output; } else { $this->backup_output = $output; } } }