id = $id; $this->path = $path; $this->type = $type; $this->storage = Storage::disk('local'); $this->parserDocx = new ParseDocx(); $this->parserXml = new ParseXml(); $this->parserHtml = new ParseHtml(); $this->parseHtmlArray = new ParseHtmlArray(); } /** * Execute the job. * * @return void */ public function handle() { $convertor = new Convertor($this->path, $this->type); try { $convertor->execute(); } catch (\Exception $exception) { \Illuminate\Support\Facades\Log::info($exception->getMessage()); $this->failed(); return; } SendToCore::dispatch($this->id, pathinfo($this->path, PATHINFO_DIRNAME)); } public function failed() { if ( ! $this->storage) { $this->storage = Storage::disk('local'); } Log::error('Ingest documents failed.'); // // @TODO Delete docx, txt and md files. // if ($this->storage->exists($this->path)) { // $this->storage->delete($this->path); // } SendToCore::dispatch($this->id, pathinfo($this->path, PATHINFO_DIRNAME), true); } }