From 88b2bba6eaae9299b37a355bb1550b3f994dc972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9mentine=20Urquizar?= Date: Tue, 30 Jun 2020 16:17:18 +0200 Subject: [PATCH] Upd package for MeiliSearch v0.11 (#27) * Upd version * Change index creation according to new createIndex prototype --- README.md | 2 +- composer.json | 2 +- src/Console/IndexMeilisearch.php | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index f562cf2..d318a8a 100644 --- a/README.md +++ b/README.md @@ -190,7 +190,7 @@ class BookController extends Controller ## Compatibility with MeiliSearch This package is compatible with the following MeiliSearch versions: -- `v0.10.X` +- `v0.11.X` ## Development Workflow diff --git a/composer.json b/composer.json index 337a653..61622b4 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "require": { "php": "^7.2.5", "laravel/scout": "^8.0", - "meilisearch/meilisearch-php": "^0.9|^0.10" + "meilisearch/meilisearch-php": "^0.11" }, "require-dev": { "orchestra/testbench": "^5.0", diff --git a/src/Console/IndexMeilisearch.php b/src/Console/IndexMeilisearch.php index 3fed60d..77a98f4 100644 --- a/src/Console/IndexMeilisearch.php +++ b/src/Console/IndexMeilisearch.php @@ -41,14 +41,14 @@ public function handle() return; } - $index = $this->argument('name'); + $creation_options = []; if ($this->option('key')) { - $index = [ - 'uid' => $this->argument('name'), - 'primaryKey' => $this->option('key'), - ]; + $creation_options = ['primaryKey' => $this->option('key')]; } - $client->createIndex($index); + $client->createIndex( + $this->argument('name'), + $creation_options + ); $this->info('Index "'.$this->argument('name').'" created.'); } catch (HTTPRequestException $exception) { $this->error($exception->getMessage());