storage = Storage::disk('local'); } public function getAfterIngest($id) { $path = $this->getPath($id); // Ingest success. if ($this->storage->exists("$path.md")) { return [ 'status' => 'success', 'content' => $this->storage->get("$path.md"), ]; } // Ingest fail. if ($this->storage->exists($path)) { return [ 'status' => 'fail', ]; } return [ 'status' => 'processing', 'message' => 'Document has not been processed yet.', ]; } public function destroy($id) { $path = $this->getPath($id); // Ingest success. if ($this->storage->exists("$path.md")) { return $this->storage->delete("$path.md"); } // Ingest fail. if ($this->storage->exists($path)) { return $this->storage->delete($path); } return false; } protected function getPath($id) { return "contracts/$id"; } }