/** * Execute the job. * * @return void */ public function handle(SourceRepository $sourceRepo) { $this->source->sync_status = "publishing"; $this->source->save(); $id = $this->source->id; $hash = $this->source->hash; $procFilePath = 'storage/app/sources/' . $id . '/p/file.processed'; $pubFilePath = 'public/sources/' . $hash . '.geojson'; // File exists in storage/app/sources/p/file.processed ? if (!Storage::disk('base')->exists($procFilePath)) { // update sync_status $this->source->sync_status = "error"; $sourceRepo->addRecord($this->source, "Processed file in {$procFilePath} does not exists!", "error"); } else { $result = $sourceRepo->publish($this->source, $procFilePath, $pubFilePath); if ($result == true) { $this->source->sync_status = "ready"; } else { $this->source->sync_status = "error"; } } $this->source->save(); $sourceRepo->addRecord($this->source, "Source published successfully!", "success"); }