site = $site; } /** * Execute the job. * * @return void */ public function handle() { $ploi = new Ploi(config('services.ploi.token')); $systemUser = $this->site->getSystemUser(); $ploiSite = $ploi->server($this->site->server->ploi_id)->sites()->create( $this->site->domain, '/public', '/', Arr::get($systemUser, 'user_name'), decrypt(Arr::get($systemUser, 'ftp_password')) ); $this->site->ploi_id = $ploiSite->data->id; $this->site->save(); // Lets fetch the status after 5 seconds dispatch(new FetchSiteStatus($this->site))->delay(now()->addSeconds(3)); } public function failed(\Exception $exception) { $this->site->delete(); } }