server = $server; $this->attempts = $attempts; } public function handle(): void { if ($this->server->provider()->isRunning()) { $this->server->install(); return; } if ($this->attempts >= 2) { $this->server->update([ 'status' => 'installation_failed', ]); event( new Broadcast('install-server-failed', [ 'server' => $this->server, ]) ); return; } dispatch(new self($this->server, $this->attempts++))->delay(now()->addMinute()); } }