Browse Source

Run Search and Displace from Web and from CLI

master
Orzu Ionut 3 years ago
parent
commit
1ebecdd005
  1. 1
      .gitignore
  2. 6
      .idea/core.iml
  3. 6
      .idea/php.xml
  4. 91
      README.md
  5. 108
      app/Console/Commands/RunSearchDisplace.php
  6. 38
      app/Events/IngestDocumentReceived.php
  7. 15
      app/Http/Controllers/HomeController.php
  8. 51
      app/Http/Controllers/SearchAndDisplaceController.php
  9. 1
      app/Http/Middleware/VerifyCsrfToken.php
  10. 29
      app/Listeners/RunSearchAndDisplaceOnDocument.php
  11. 9
      app/Providers/EventServiceProvider.php
  12. 32
      app/SearchDisplace/Documents/DocumentFile.php
  13. 3
      app/SearchDisplace/Ingest/HandleReceivedDocument.php
  14. 59
      app/SearchDisplace/Ingest/SendDocument.php
  15. 64
      app/SearchDisplace/SearchAndDisplace.php
  16. 56
      app/SearchDisplace/SearchAndDisplaceFromFiles.php
  17. 40
      app/SearchDisplace/Searchers/Duckling.php
  18. 8
      app/SearchDisplace/Searchers/Handlers/Emails.php
  19. 64
      app/SearchDisplace/Searchers/Mapper.php
  20. 26
      app/SearchDisplace/Searchers/Searcher.php
  21. 1
      app/SearchDisplace/Webhooks/HandleRequest.php
  22. 1
      composer.json
  23. 384
      composer.lock
  24. 65
      resources/js/components/Home.vue
  25. 2
      resources/views/pages/home.blade.php
  26. 7
      routes/web.php

1
.gitignore

@ -10,3 +10,4 @@ Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
.idea

6
.idea/core.iml

@ -101,6 +101,12 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/phpspec/prophecy" />
<excludeFolder url="file://$MODULE_DIR$/vendor/spatie/laravel-webhook-client" />
<excludeFolder url="file://$MODULE_DIR$/vendor/predis/predis" />
<excludeFolder url="file://$MODULE_DIR$/vendor/ralouphie/getallheaders" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/http-client" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/http-message" />
<excludeFolder url="file://$MODULE_DIR$/vendor/guzzlehttp/promises" />
<excludeFolder url="file://$MODULE_DIR$/vendor/guzzlehttp/psr7" />
<excludeFolder url="file://$MODULE_DIR$/vendor/guzzlehttp/guzzle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />

6
.idea/php.xml

@ -98,6 +98,12 @@
<path value="$PROJECT_DIR$/vendor/phpspec/prophecy" />
<path value="$PROJECT_DIR$/vendor/spatie/laravel-webhook-client" />
<path value="$PROJECT_DIR$/vendor/predis/predis" />
<path value="$PROJECT_DIR$/vendor/ralouphie/getallheaders" />
<path value="$PROJECT_DIR$/vendor/psr/http-client" />
<path value="$PROJECT_DIR$/vendor/psr/http-message" />
<path value="$PROJECT_DIR$/vendor/guzzlehttp/promises" />
<path value="$PROJECT_DIR$/vendor/guzzlehttp/psr7" />
<path value="$PROJECT_DIR$/vendor/guzzlehttp/guzzle" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="7.2" />

91
README.md

@ -1,78 +1,13 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400"></a></p>
<p align="center">
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/d/total.svg" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/v/stable.svg" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/license.svg" alt="License"></a>
</p>
## About Laravel
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
Laravel is accessible, powerful, and provides tools required for large, robust applications.
## Learning Laravel
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
## Laravel Sponsors
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Cubet Techno Labs](https://cubettech.com)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[British Software Development](https://www.britishsoftware.co)**
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
- **[DevSquad](https://devsquad.com)**
- [UserInsights](https://userinsights.com)
- [Fragrantica](https://www.fragrantica.com)
- [SOFTonSOFA](https://softonsofa.com/)
- [User10](https://user10.com)
- [Soumettre.fr](https://soumettre.fr/)
- [CodeBrisk](https://codebrisk.com)
- [1Forge](https://1forge.com)
- [TECPRESSO](https://tecpresso.co.jp/)
- [Runtime Converter](http://runtimeconverter.com/)
- [WebL'Agence](https://weblagence.com/)
- [Invoice Ninja](https://www.invoiceninja.com)
- [iMi digital](https://www.imi-digital.de/)
- [Earthlink](https://www.earthlink.ro/)
- [Steadfast Collective](https://steadfastcollective.com/)
- [We Are The Robots Inc.](https://watr.mx/)
- [Understand.io](https://www.understand.io/)
- [Abdel Elrafa](https://abdelelrafa.com)
- [Hyper Host](https://hyper.host)
- [Appoly](https://www.appoly.co.uk)
- [OP.GG](https://op.gg)
## Contributing
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
## Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
## Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
## License
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
# Search and Displace Core
## Install
### Search and Displace Ingest integration
Add in .env the 'WEBHOOK_CLIENT_SECRET' value.
### Facebook Duckling
- `$ apt-get install libpcre3-dev`
- `$ cd ..`
- `$ git clone https://github.com/facebook/duckling.git && cd duckling`
- `$ curl -sSL https://get.haskellstack.org/ | sh`
- `$ stack build && stack exec duckling-example-exe`
- `$ stack test`

108
app/Console/Commands/RunSearchDisplace.php

@ -0,0 +1,108 @@
<?php
namespace App\Console\Commands;
use App\SearchDisplace\Ingest\SendDocument;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Storage;
class RunSearchDisplace extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'sd:run
{path : The document path}
{filters* : The filters which will be applied to the search}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Run search and displace on document with filters.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
*/
public function handle()
{
$documentPath = $this->argument('path');
$searchers = $this->argument('filters');
$id = md5(uniqid(rand(), true));
$this->storeSearchers($id, $searchers, $documentPath);
try {
$sendToIngest = new SendDocument();
$sendToIngest->execute($documentPath, $id);
$this->info('Processing document..');
$this->info('After the processing will be done the result will show up at the same path as the input.');
} catch (\Exception $exception) {
$this->error('Something went wrong. (' . $exception->getMessage() . ')');
}
}
protected function storeSearchers($id, $searchers, $documentPath)
{
$data = [
'searchers' => $this->getSearchers($searchers),
'document_path' => $documentPath,
];
$storage = Storage::disk('local');
$storage->put("searchers/$id.json", json_encode($data));
}
protected function getSearchers($searchers)
{
if (count($searchers) === 1 && str_contains($searchers[0], '.json')) {
return $this->getSearchersFromFile($searchers[0]);
}
return $this->getSearchersFromList($searchers);
}
protected function getSearchersFromList($searchers)
{
$list = [];
foreach ($searchers as $searcher) {
$result = explode(':', $searcher);
$list[] = [
'key' => $result[0],
'replace_with' => $result[1],
];
}
return $list;
}
protected function getSearchersFromFile($path)
{
$contents = file_get_contents($path);
if ( ! $contents) {
throw new \Exception('Something went wrong when tried reading from file.');
}
return json_decode($contents);
}
}

38
app/Events/IngestDocumentReceived.php

@ -0,0 +1,38 @@
<?php
namespace App\Events;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class IngestDocumentReceived
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public $id;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($id)
{
$this->id = $id;
}
/**
* Get the channels the event should broadcast on.
*
* @return \Illuminate\Broadcasting\Channel|array
*/
public function broadcastOn()
{
return new PrivateChannel('channel-name');
}
}

15
app/Http/Controllers/HomeController.php

@ -0,0 +1,15 @@
<?php
namespace App\Http\Controllers;
use App\SearchDisplace\Searchers\Mapper;
class HomeController extends Controller
{
public function index()
{
return view('pages.home', [
'searchers' => (new Mapper())->get(),
]);
}
}

51
app/Http/Controllers/SearchAndDisplaceController.php

@ -0,0 +1,51 @@
<?php
namespace App\Http\Controllers;
use App\SearchDisplace\Documents\DocumentFile;
use App\SearchDisplace\SearchAndDisplace;
class SearchAndDisplaceController extends Controller
{
public function show($id)
{
$handler = new DocumentFile();
try {
$documentContent = $handler->getAfterIngest($id);
return response()->json([
'content' => $documentContent,
'ingest_status' => !! $documentContent ? 'success' : 'fail',
], 200);
} catch (\Exception $exception) {
return response()->json([
'message' => $exception->getMessage(),
], 400);
}
}
public function store()
{
request()->validate([
'content' => 'required', // String or file.
'searchers' => 'required|array', // Check if matches all rules, must have 'key' and 'replace_with'.
]);
$searchAndDisplace = new SearchAndDisplace(request()->get('content'), [
'searchers' => request()->get('searchers'),
]);
try {
$resultedDocumentContent = $searchAndDisplace->execute();
return response()->json([
'content' => $resultedDocumentContent,
], 200);
} catch (\Exception $exception) {
return response()->json([
'message' => $exception->getMessage(),
], 400);
}
}
}

1
app/Http/Middleware/VerifyCsrfToken.php

@ -20,5 +20,6 @@ class VerifyCsrfToken extends Middleware
*/
protected $except = [
'/webhooks',
'/search-and-displace',
];
}

29
app/Listeners/RunSearchAndDisplaceOnDocument.php

@ -0,0 +1,29 @@
<?php
namespace App\Listeners;
use App\SearchDisplace\SearchAndDisplaceFromFiles;
class RunSearchAndDisplaceOnDocument
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param $event
* @return void
*/
public function handle($event)
{
(new SearchAndDisplaceFromFiles($event->id))->execute();
}
}

9
app/Providers/EventServiceProvider.php

@ -2,10 +2,9 @@
namespace App\Providers;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use App\Events\IngestDocumentReceived;
use App\Listeners\RunSearchAndDisplaceOnDocument;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{
@ -15,8 +14,8 @@ class EventServiceProvider extends ServiceProvider
* @var array
*/
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
IngestDocumentReceived::class => [
RunSearchAndDisplaceOnDocument::class,
],
];

32
app/SearchDisplace/Documents/DocumentFile.php

@ -0,0 +1,32 @@
<?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.');
}
}

3
app/SearchDisplace/Ingest/HandleReceivedDocument.php

@ -2,6 +2,7 @@
namespace App\SearchDisplace\Ingest;
use App\Events\IngestDocumentReceived;
use Illuminate\Support\Facades\Storage;
class HandleReceivedDocument
@ -30,6 +31,8 @@ class HandleReceivedDocument
try {
$storage->put("contracts/${fileName}", $this->content);
IngestDocumentReceived::dispatch($this->id);
} catch (\Exception $exception) {
\Illuminate\Support\Facades\Log::info('exception. :' . $exception->getMessage());
}

59
app/SearchDisplace/Ingest/SendDocument.php

@ -0,0 +1,59 @@
<?php
namespace App\SearchDisplace\Ingest;
use GuzzleHttp\Client;
class SendDocument
{
protected $url;
public function __construct()
{
$this->url = env('SD_INGEST_URL') . '/ingest';
}
public function execute($documentPath, $id)
{
try {
$response = $this->sendRequest($documentPath, $id);
if ($response['status'] === 'fail') {
$message = array_key_exists('message', $response)
? $response['message']
: 'Something went wrong.';
throw new \Exception($message);
}
// The file in Ingest si in Processing state.
} catch (\Exception $exception) {
throw new \Exception($exception->getMessage());
}
}
public function sendRequest($documentPath, $id)
{
$client = new Client();
$response = $client->request('post', $this->url, [
'headers' => [
'Accept' => 'application/json',
],
'multipart' => [
[
'name' => 'id',
'contents' => $id,
],
[
'name' => 'document',
'contents' => fopen($documentPath, 'r'),
]
],
]);
return json_decode($response->getBody()->getContents(), true);
}
}

64
app/SearchDisplace/SearchAndDisplace.php

@ -0,0 +1,64 @@
<?php
namespace App\SearchDisplace;
use App\SearchDisplace\Searchers\Searcher;
class SearchAndDisplace
{
protected $documentContent;
protected $info;
public function __construct($documentContent, $info)
{
$this->documentContent = $documentContent;
$this->info = $info;
}
public function execute()
{
$searchResult = $this->search();
return $this->displace($searchResult);
}
/**
*
* @return mixed
* @throws \Exception
*/
protected function search()
{
$searcher = new Searcher($this->info['searchers'], $this->documentContent);
return $searcher->execute();
}
protected function displace($searchResult)
{
$replacements = [];
foreach ($this->info['searchers'] as $searcher) {
$replacements[$searcher['key']] = $searcher['replace_with'];
}
$updatedDocumentContent = '';
$currentIndex = 0;
foreach ($searchResult as $item) {
$partialContent = substr($this->documentContent, $currentIndex, $item['start'] - $currentIndex);
$updatedDocumentContent = $updatedDocumentContent . $partialContent;
$updatedDocumentContent = $updatedDocumentContent . $replacements[$item['dim']];
$currentIndex = $item['end'];
}
if ($currentIndex < strlen($this->documentContent) - 1) {
$updatedDocumentContent = $updatedDocumentContent . substr($this->documentContent, $currentIndex);
}
return $updatedDocumentContent;
}
}

56
app/SearchDisplace/SearchAndDisplaceFromFiles.php

@ -0,0 +1,56 @@
<?php
namespace App\SearchDisplace;
use Illuminate\Support\Facades\Storage;
class SearchAndDisplaceFromFiles
{
protected $id;
protected $storage;
protected $documentFilePath;
protected $infoFilePath;
public function __construct($id)
{
$this->id = $id;
$this->storage = Storage::disk('local');
$this->documentFilePath = "contracts/$this->id.md";
$this->infoFilePath = "searchers/$this->id.json";
}
public function execute()
{
if ( ! $this->storage->exists($this->documentFilePath) ||
! $this->storage->exists($this->infoFilePath)
) {
// Handle this case, must report result to user.
return;
}
$documentContent = $this->storage->get($this->documentFilePath);
$info = json_decode($this->storage->get($this->infoFilePath), true);
$searchAndDisplace = new SearchAndDisplace($documentContent, $info);
$originalDocumentPath = $info['document_path'];
$pathDetails = pathinfo($originalDocumentPath);
$resultedDocumentPath = $pathDetails['dirname'] . '/' . $pathDetails['filename'] . '-displaced.md';
try {
$resultedDocumentContent = $searchAndDisplace->execute();
file_put_contents($resultedDocumentPath, $resultedDocumentContent);
} catch (\Exception $exception) {
\Illuminate\Support\Facades\Log::info('exception: ' . $exception->getMessage());
return;
} finally {
$this->storage->delete($this->documentFilePath);
$this->storage->delete($this->infoFilePath);
}
}
}

40
app/SearchDisplace/Searchers/Duckling.php

@ -0,0 +1,40 @@
<?php
namespace App\SearchDisplace\Searchers;
use GuzzleHttp\Client;
class Duckling
{
protected $url;
public function __construct()
{
$this->url = env('SD_DUCKLING_URL');
}
public function execute($content, $dimensions)
{
// @TODO Parse result
return $this->sendRequest($content, $dimensions);
}
protected function sendRequest($text, $dimensions)
{
$client = new Client();
$response = $client->request('post', $this->url, [
'headers' => [
'Accept' => 'application/json',
],
'form_params' => [
'locale' => 'en_GB',
'text' => $text,
'dims' => json_encode($dimensions),
],
]);
return json_decode($response->getBody()->getContents(), true);
}
}

8
app/SearchDisplace/Searchers/Handlers/Emails.php

@ -1,8 +0,0 @@
<?php
namespace App\SearchDisplace\Searchers\Handlers;
class Emails
{
// Use 'duckling' wrapper to find 'emails' in document.
}

64
app/SearchDisplace/Searchers/Mapper.php

@ -2,8 +2,6 @@
namespace App\SearchDisplace\Searchers;
use App\SearchDisplace\Searchers\Handlers\Emails;
class Mapper
{
protected $mapper;
@ -11,15 +9,73 @@ class Mapper
public function __construct()
{
$this->mapper = [
'amount-of-money' => [
'name' => 'Amount Of Money',
],
'credit-card-number' => [
'name' => 'Credit Card Number',
],
'distance' => [
'name' => 'Distance',
],
'duration' => [
'name' => 'Duration',
],
'email' => [
'name' => 'Email',
'handler' => Emails::class,
],
'numeral' => [
'name' => 'Numeral',
],
'ordinal' => [
'name' => 'Ordinal',
],
'phone-number' => [
'name' => 'Phone Number',
],
'quantity' => [
'name' => 'Quantity',
],
'temperature' => [
'name' => 'Temperature',
],
'time' => [
'name' => 'Time',
],
'url' => [
'name' => 'URL',
],
'volume' => [
'name' => 'Volume',
],
];
}
public function get()
public function getSearchers()
{
return array_keys($this->mapper);
}
public function get()
{
$items = [];
foreach ($this->mapper as $key => $value) {
$items[$key] = $value['name'];
}
return $items;
}
}

26
app/SearchDisplace/Searchers/Searcher.php

@ -5,18 +5,36 @@ namespace App\SearchDisplace\Searchers;
class Searcher
{
protected $searchers;
protected $content;
public function __construct($searchers)
public function __construct($searchers, $content)
{
$this->searchers = $searchers;
$this->content = $content;
ksort($this->searchers);
}
public function execute()
{
// Iterate through searchers and check if they are valid by comparing to Mapper's data.
// If at least one searcher does not exist throw exception.
$mapper = new Mapper();
$validSearchers = $mapper->getSearchers();
// Searchers can be a mapper too, the key is the order number and the value is the object.
// The object should contain the searcher name, other info, like the user input.
$dimensions = [];
foreach ($this->searchers as $orderNumber => $searcher) {
if ( ! in_array($searcher['key'], $validSearchers)) {
throw new \Exception('Invalid searcher: ' . $searcher['key']);
}
$dimensions[] = $searcher['key'];
}
$duckling = new Duckling();
return $duckling->execute($this->content, $dimensions);
}
}

1
app/SearchDisplace/Webhooks/HandleRequest.php

@ -16,6 +16,7 @@ class HandleRequest extends ProcessWebhookJob
return true;
} catch (\Exception $exception) {
return false;
}
}

1
composer.json

@ -10,6 +10,7 @@
"require": {
"php": "^7.2.5|^8.0",
"fideloper/proxy": "^4.4",
"guzzlehttp/guzzle": "^7.3",
"laravel/framework": "^6.20",
"laravel/tinker": "^2.5",
"predis/predis": "^1.1",

384
composer.lock

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "1a329a16a209985ecb9d0ea57cd5dd7c",
"content-hash": "742d3ec216a05b96ed9300e0ccf4e44e",
"packages": [
{
"name": "doctrine/inflector",
@ -371,6 +371,239 @@
},
"time": "2020-10-22T13:48:01+00:00"
},
{
"name": "guzzlehttp/guzzle",
"version": "7.3.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "7008573787b430c1c1f650e3722d9bba59967628"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/7008573787b430c1c1f650e3722d9bba59967628",
"reference": "7008573787b430c1c1f650e3722d9bba59967628",
"shasum": ""
},
"require": {
"ext-json": "*",
"guzzlehttp/promises": "^1.4",
"guzzlehttp/psr7": "^1.7 || ^2.0",
"php": "^7.2.5 || ^8.0",
"psr/http-client": "^1.0"
},
"provide": {
"psr/http-client-implementation": "1.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4.1",
"ext-curl": "*",
"php-http/client-integration-tests": "^3.0",
"phpunit/phpunit": "^8.5.5 || ^9.3.5",
"psr/log": "^1.1"
},
"suggest": {
"ext-curl": "Required for CURL handler support",
"ext-intl": "Required for Internationalized Domain Name (IDN) support",
"psr/log": "Required for using the Log middleware"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "7.3-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com",
"homepage": "https://sagikazarmark.hu"
}
],
"description": "Guzzle is a PHP HTTP client library",
"homepage": "http://guzzlephp.org/",
"keywords": [
"client",
"curl",
"framework",
"http",
"http client",
"psr-18",
"psr-7",
"rest",
"web service"
],
"support": {
"issues": "https://github.com/guzzle/guzzle/issues",
"source": "https://github.com/guzzle/guzzle/tree/7.3.0"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://github.com/Nyholm",
"type": "github"
},
{
"url": "https://github.com/alexeyshockov",
"type": "github"
},
{
"url": "https://github.com/gmponos",
"type": "github"
}
],
"time": "2021-03-23T11:33:13+00:00"
},
{
"name": "guzzlehttp/promises",
"version": "1.4.1",
"source": {
"type": "git",
"url": "https://github.com/guzzle/promises.git",
"reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/promises/zipball/8e7d04f1f6450fef59366c399cfad4b9383aa30d",
"reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d",
"shasum": ""
},
"require": {
"php": ">=5.5"
},
"require-dev": {
"symfony/phpunit-bridge": "^4.4 || ^5.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Promise\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "Guzzle promises library",
"keywords": [
"promise"
],
"support": {
"issues": "https://github.com/guzzle/promises/issues",
"source": "https://github.com/guzzle/promises/tree/1.4.1"
},
"time": "2021-03-07T09:25:29+00:00"
},
{
"name": "guzzlehttp/psr7",
"version": "1.8.2",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "dc960a912984efb74d0a90222870c72c87f10c91"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/dc960a912984efb74d0a90222870c72c87f10c91",
"reference": "dc960a912984efb74d0a90222870c72c87f10c91",
"shasum": ""
},
"require": {
"php": ">=5.4.0",
"psr/http-message": "~1.0",
"ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
},
"provide": {
"psr/http-message-implementation": "1.0"
},
"require-dev": {
"ext-zlib": "*",
"phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10"
},
"suggest": {
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.7-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Psr7\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Tobias Schultze",
"homepage": "https://github.com/Tobion"
}
],
"description": "PSR-7 message implementation that also provides common utility methods",
"keywords": [
"http",
"message",
"psr-7",
"request",
"response",
"stream",
"uri",
"url"
],
"support": {
"issues": "https://github.com/guzzle/psr7/issues",
"source": "https://github.com/guzzle/psr7/tree/1.8.2"
},
"time": "2021-04-26T09:17:50+00:00"
},
{
"name": "laravel/framework",
"version": "v6.20.26",
@ -1387,6 +1620,111 @@
},
"time": "2021-03-05T17:36:06+00:00"
},
{
"name": "psr/http-client",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-client.git",
"reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
"reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
"shasum": ""
},
"require": {
"php": "^7.0 || ^8.0",
"psr/http-message": "^1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Client\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for HTTP clients",
"homepage": "https://github.com/php-fig/http-client",
"keywords": [
"http",
"http-client",
"psr",
"psr-18"
],
"support": {
"source": "https://github.com/php-fig/http-client/tree/master"
},
"time": "2020-06-29T06:28:15+00:00"
},
{
"name": "psr/http-message",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for HTTP messages",
"homepage": "https://github.com/php-fig/http-message",
"keywords": [
"http",
"http-message",
"psr",
"psr-7",
"request",
"response"
],
"support": {
"source": "https://github.com/php-fig/http-message/tree/master"
},
"time": "2016-08-06T14:39:51+00:00"
},
{
"name": "psr/log",
"version": "1.1.4",
@ -1563,6 +1901,50 @@
},
"time": "2021-04-10T16:23:39+00:00"
},
{
"name": "ralouphie/getallheaders",
"version": "3.0.3",
"source": {
"type": "git",
"url": "https://github.com/ralouphie/getallheaders.git",
"reference": "120b605dfeb996808c31b6477290a714d356e822"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
"reference": "120b605dfeb996808c31b6477290a714d356e822",
"shasum": ""
},
"require": {
"php": ">=5.6"
},
"require-dev": {
"php-coveralls/php-coveralls": "^2.1",
"phpunit/phpunit": "^5 || ^6.5"
},
"type": "library",
"autoload": {
"files": [
"src/getallheaders.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ralph Khattar",
"email": "ralph.khattar@gmail.com"
}
],
"description": "A polyfill for getallheaders.",
"support": {
"issues": "https://github.com/ralouphie/getallheaders/issues",
"source": "https://github.com/ralouphie/getallheaders/tree/develop"
},
"time": "2019-03-08T08:55:37+00:00"
},
{
"name": "ramsey/uuid",
"version": "3.9.3",

65
resources/js/components/Home.vue

@ -13,47 +13,54 @@
</FileUpload>
</Panel>
<!-- <process-file :files="files"></process-file>-->
<!-- <process-file :files="files"></process-file>-->
<BlockUI :blocked="uiBlocked" :fullScreen="true"></BlockUI>
</div>
</template>
<script>
import FileUpload from 'primevue/fileupload';
import BlockUI from 'primevue/blockui';
import Panel from 'primevue/panel';
export default {
data() {
return {
uiBlocked: false,
files: [],
};
},
import FileUpload from 'primevue/fileupload';
import BlockUI from 'primevue/blockui';
import Panel from 'primevue/panel';
export default {
data() {
return {
uiBlocked: false,
files: [],
};
},
components: {
FileUpload,
BlockUI,
Panel,
props: {
filters: {
required: true,
type: Array,
},
},
components: {
FileUpload,
BlockUI,
Panel,
},
methods: {
myUploader(event) {
this.uiBlocked = true;
methods: {
myUploader(event) {
this.uiBlocked = true;
event.files.forEach((file) => {
// Handle the file
event.files.forEach((file) => {
// Handle the file
this.files.push(file);
});
this.files.push(file);
});
setTimeout(() => {
this.uiBlocked = false;
setTimeout(() => {
this.uiBlocked = false;
// this.$router.push('process-file');
}, 500);
},
// this.$router.push('process-file');
}, 500);
},
};
},
};
</script>

2
resources/views/pages/home.blade.php

@ -2,6 +2,6 @@
@section('content')
<home></home>
<home :filters="{{ json_encode($searchers) }}"></home>
@endsection

7
routes/web.php

@ -11,8 +11,9 @@
|
*/
Route::get('/', function () {
return view('pages.home');
});
Route::get('/', 'HomeController@index');
Route::get('/search-and-displace/{id}', 'SearchAndDisplaceController@show');
Route::post('/search-and-displace', 'SearchAndDisplaceController@store');
Route::webhooks('/webhooks', 'default');
Loading…
Cancel
Save