id = $payload['data']['id']; $this->content = $payload['data']['content']; $this->status = $payload['data']['status']; } public function handle() { $storage = Storage::disk('local'); $fileName = $this->id; // The .md extension signals the success status, the lack of signals the fail status. if ($this->status === 'success') { $fileName = $fileName . '.md'; } try { $storage->put("contracts/${fileName}", $this->content); IngestDocumentReceived::dispatch($this->id); } catch (\Exception $exception) { \Illuminate\Support\Facades\Log::info('Exception: ' . $exception->getTraceAsString()); } } }