Alex Puiu 5 years ago
parent
commit
e95f5af116
  1. 18
      app/SearchDisplace/SearchAndDisplaceJSON.php

18
app/SearchDisplace/SearchAndDisplaceJSON.php

@ -9,10 +9,12 @@ 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');
@ -20,6 +22,18 @@ class SearchAndDisplaceJSON
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