Alex Puiu 4 years ago
parent
commit
e95f5af116
  1. 20
      app/SearchDisplace/SearchAndDisplaceJSON.php

20
app/SearchDisplace/SearchAndDisplaceJSON.php

@ -9,17 +9,31 @@ class SearchAndDisplaceJSON
{ {
protected $file; protected $file;
protected $searchers; protected $searchers;
protected $searchOnly;
protected $content;
public function __construct($file, $searchers)
public function __construct($file, $searchers, $searchOnly)
{ {
$this->file = $file . '/document.json';
$searchOnly ? $this->content = $file : $this->file = $file . '/document.json';
$this->searchers = $searchers; $this->searchers = $searchers;
$this->storage = Storage::disk('local'); $this->storage = Storage::disk('local');
} }
public function execute() public function execute()
{ {
if(isset($this->content)) {
$search = new SearchAndDisplace(
stripslashes($this->content),
[
'searchers' => $this->searchers,
],
true
);
return $search->execute();
}
if(! $this->storage->exists("contracts/$this->file")) { if(! $this->storage->exists("contracts/$this->file")) {
return; return;
} }

Loading…
Cancel
Save