diff --git a/.gitignore b/.gitignore
index 0f7df0f..f5b7047 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,4 @@ Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
+.idea
diff --git a/.idea/core.iml b/.idea/core.iml
index c6c2c7e..3c366e7 100644
--- a/.idea/core.iml
+++ b/.idea/core.iml
@@ -101,6 +101,12 @@
+
+
+
+
+
+
diff --git a/.idea/php.xml b/.idea/php.xml
index bd9d6e0..f466fa0 100644
--- a/.idea/php.xml
+++ b/.idea/php.xml
@@ -98,6 +98,12 @@
+
+
+
+
+
+
diff --git a/README.md b/README.md
index 4e2cadb..7ddfb9e 100644
--- a/README.md
+++ b/README.md
@@ -1,78 +1,13 @@
-
-
-
-
-
-
-
-
-
-## 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`
diff --git a/app/Console/Commands/RunSearchDisplace.php b/app/Console/Commands/RunSearchDisplace.php
new file mode 100644
index 0000000..06cfe00
--- /dev/null
+++ b/app/Console/Commands/RunSearchDisplace.php
@@ -0,0 +1,108 @@
+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);
+ }
+}
diff --git a/app/Events/IngestDocumentReceived.php b/app/Events/IngestDocumentReceived.php
new file mode 100644
index 0000000..a87b19c
--- /dev/null
+++ b/app/Events/IngestDocumentReceived.php
@@ -0,0 +1,38 @@
+id = $id;
+ }
+
+ /**
+ * Get the channels the event should broadcast on.
+ *
+ * @return \Illuminate\Broadcasting\Channel|array
+ */
+ public function broadcastOn()
+ {
+ return new PrivateChannel('channel-name');
+ }
+}
diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php
new file mode 100644
index 0000000..85618e1
--- /dev/null
+++ b/app/Http/Controllers/HomeController.php
@@ -0,0 +1,15 @@
+ (new Mapper())->get(),
+ ]);
+ }
+}
diff --git a/app/Http/Controllers/SearchAndDisplaceController.php b/app/Http/Controllers/SearchAndDisplaceController.php
new file mode 100644
index 0000000..36c1c7b
--- /dev/null
+++ b/app/Http/Controllers/SearchAndDisplaceController.php
@@ -0,0 +1,51 @@
+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);
+ }
+ }
+}
diff --git a/app/Http/Middleware/VerifyCsrfToken.php b/app/Http/Middleware/VerifyCsrfToken.php
index 21821b1..885232e 100644
--- a/app/Http/Middleware/VerifyCsrfToken.php
+++ b/app/Http/Middleware/VerifyCsrfToken.php
@@ -20,5 +20,6 @@ class VerifyCsrfToken extends Middleware
*/
protected $except = [
'/webhooks',
+ '/search-and-displace',
];
}
diff --git a/app/Listeners/RunSearchAndDisplaceOnDocument.php b/app/Listeners/RunSearchAndDisplaceOnDocument.php
new file mode 100644
index 0000000..717e41e
--- /dev/null
+++ b/app/Listeners/RunSearchAndDisplaceOnDocument.php
@@ -0,0 +1,29 @@
+id))->execute();
+ }
+}
diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php
index 723a290..3fd8270 100644
--- a/app/Providers/EventServiceProvider.php
+++ b/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,
],
];
diff --git a/app/SearchDisplace/Documents/DocumentFile.php b/app/SearchDisplace/Documents/DocumentFile.php
new file mode 100644
index 0000000..c4b7dce
--- /dev/null
+++ b/app/SearchDisplace/Documents/DocumentFile.php
@@ -0,0 +1,32 @@
+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.');
+ }
+}
diff --git a/app/SearchDisplace/Ingest/HandleReceivedDocument.php b/app/SearchDisplace/Ingest/HandleReceivedDocument.php
index 96d0cf1..543bab8 100644
--- a/app/SearchDisplace/Ingest/HandleReceivedDocument.php
+++ b/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());
}
diff --git a/app/SearchDisplace/Ingest/SendDocument.php b/app/SearchDisplace/Ingest/SendDocument.php
new file mode 100644
index 0000000..7a6615b
--- /dev/null
+++ b/app/SearchDisplace/Ingest/SendDocument.php
@@ -0,0 +1,59 @@
+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);
+ }
+}
diff --git a/app/SearchDisplace/SearchAndDisplace.php b/app/SearchDisplace/SearchAndDisplace.php
new file mode 100644
index 0000000..c7501be
--- /dev/null
+++ b/app/SearchDisplace/SearchAndDisplace.php
@@ -0,0 +1,64 @@
+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;
+ }
+}
diff --git a/app/SearchDisplace/SearchAndDisplaceFromFiles.php b/app/SearchDisplace/SearchAndDisplaceFromFiles.php
new file mode 100644
index 0000000..82d3d91
--- /dev/null
+++ b/app/SearchDisplace/SearchAndDisplaceFromFiles.php
@@ -0,0 +1,56 @@
+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);
+ }
+ }
+}
diff --git a/app/SearchDisplace/Searchers/Duckling.php b/app/SearchDisplace/Searchers/Duckling.php
new file mode 100644
index 0000000..766fa00
--- /dev/null
+++ b/app/SearchDisplace/Searchers/Duckling.php
@@ -0,0 +1,40 @@
+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);
+ }
+}
diff --git a/app/SearchDisplace/Searchers/Handlers/Emails.php b/app/SearchDisplace/Searchers/Handlers/Emails.php
deleted file mode 100644
index a1f529c..0000000
--- a/app/SearchDisplace/Searchers/Handlers/Emails.php
+++ /dev/null
@@ -1,8 +0,0 @@
-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;
+ }
}
diff --git a/app/SearchDisplace/Searchers/Searcher.php b/app/SearchDisplace/Searchers/Searcher.php
index c59fb3b..931d4c6 100644
--- a/app/SearchDisplace/Searchers/Searcher.php
+++ b/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);
}
}
diff --git a/app/SearchDisplace/Webhooks/HandleRequest.php b/app/SearchDisplace/Webhooks/HandleRequest.php
index fbffdf6..59936f5 100644
--- a/app/SearchDisplace/Webhooks/HandleRequest.php
+++ b/app/SearchDisplace/Webhooks/HandleRequest.php
@@ -16,6 +16,7 @@ class HandleRequest extends ProcessWebhookJob
return true;
} catch (\Exception $exception) {
+
return false;
}
}
diff --git a/composer.json b/composer.json
index 2c27e64..0243f9c 100644
--- a/composer.json
+++ b/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",
diff --git a/composer.lock b/composer.lock
index a1dbf38..684e678 100644
--- a/composer.lock
+++ b/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",
diff --git a/resources/js/components/Home.vue b/resources/js/components/Home.vue
index a1f286d..61fd206 100644
--- a/resources/js/components/Home.vue
+++ b/resources/js/components/Home.vue
@@ -13,47 +13,54 @@
-
+
diff --git a/resources/views/pages/home.blade.php b/resources/views/pages/home.blade.php
index 06fb7c7..9569d6d 100644
--- a/resources/views/pages/home.blade.php
+++ b/resources/views/pages/home.blade.php
@@ -2,6 +2,6 @@
@section('content')
-
+
@endsection
diff --git a/routes/web.php b/routes/web.php
index 74a2fe9..5462497 100644
--- a/routes/web.php
+++ b/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');