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
32 lines
632 B
<?php
|
|
|
|
namespace App\SearchDisplace\Documents;
|
|
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
class DocumentFile
|
|
{
|
|
protected $storage;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->storage = Storage::disk('local');
|
|
}
|
|
|
|
public function getAfterIngest($id)
|
|
{
|
|
$path = "contracts/$id";
|
|
|
|
// Ingest success.
|
|
if ($this->storage->exists("$path.md")) {
|
|
return $this->storage->get("$path.md");
|
|
}
|
|
|
|
// Ingest fail.
|
|
if ($this->storage->exists($path)) {
|
|
return '';
|
|
}
|
|
|
|
throw new \Exception('Document has not been processed yet.');
|
|
}
|
|
}
|