babenkoivan / elastic-migrations

Elasticsearch migrations for Laravel
MIT License
187 stars 32 forks source link

migrations error-- use of undefined constant #17

Closed chris259 closed 3 years ago

chris259 commented 3 years ago

Trying to follow your guide posted at https://itnext.io/the-ultimate-guide-to-elasticsearch-in-laravel-application-ee636b79419c, and keep getting an error like this: ErrorException

Use of undefined constant ‘users’ - assumed '‘users’' (this will throw an Error in a future version of PHP)

at elastic/migrations/2021_01_30_075117_create_users_index.php:16 12▕ Run the migration. 13▕ / 14▕ public function up(): void 15▕ { ➜ 16▕ Index::create(‘users’, function (Mapping $mapping, Settings $settings) { 17▕ $mapping->text(‘name’); 18▕ $mapping->keyword(‘email’); 19▕ }); 20▕ }

1 elastic/migrations/2021_01_30_075117_create_users_index.php:16 Illuminate\Foundation\Bootstrap\HandleExceptions::handleError()

  +18 vendor frames 

20 artisan:37 Illuminate\Foundation\Console\Kernel::handle()

my migrations file is like that in your article: `final class CreateUsersIndex implements MigrationInterface { /**

Thank you

Software Version
PHP 7.4.3
Elasticsearch 7.10.1
Laravel 8.25.0
babenkoivan commented 3 years ago

Hi @chris259, I think the code snippets had a wrong quote type, fixed it. It should be ', not .

chris259 commented 3 years ago

Thank you. I feel silly.