Repo for the search and displace core module including the interface to select files and search and displace operations to run on them. https://searchanddisplace.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
632 B

  1. <?php
  2. namespace App\SearchDisplace\Documents;
  3. use Illuminate\Support\Facades\Storage;
  4. class DocumentFile
  5. {
  6. protected $storage;
  7. public function __construct()
  8. {
  9. $this->storage = Storage::disk('local');
  10. }
  11. public function getAfterIngest($id)
  12. {
  13. $path = "contracts/$id";
  14. // Ingest success.
  15. if ($this->storage->exists("$path.md")) {
  16. return $this->storage->get("$path.md");
  17. }
  18. // Ingest fail.
  19. if ($this->storage->exists($path)) {
  20. return '';
  21. }
  22. throw new \Exception('Document has not been processed yet.');
  23. }
  24. }