elasticsearch icon indicating copy to clipboard operation
elasticsearch copied to clipboard

Class starts_with not found

Open saguajardo opened this issue 4 years ago • 1 comments

Class starts_with not found in src/ElasticsearchServiceProvider.php

You can replace it by str_starts_with()

Your code is:

`if(version_compare($this->app->version(), '5.1', ">=") or starts_with($this->app->version(), "Lumen")) {

if ($this->app->runningInConsole()) {

    // Registering commands

    $this->commands([
        ListIndicesCommand::class,
        CreateIndexCommand::class,
        UpdateIndexCommand::class,
        DropIndexCommand::class,
        ReindexCommand::class
    ]);

}

}`

Your new code should be:

`if(version_compare($this->app->version(), '5.1', ">=") or str_starts_with($this->app->version(), "Lumen")) {

if ($this->app->runningInConsole()) {

    // Registering commands

    $this->commands([
        ListIndicesCommand::class,
        CreateIndexCommand::class,
        UpdateIndexCommand::class,
        DropIndexCommand::class,
        ReindexCommand::class
    ]);

}

}`

saguajardo avatar Dec 29 '20 19:12 saguajardo

Link to the problematic line: https://github.com/basemkhirat/elasticsearch/blob/33ea95c730b35a3f29f4ba5c1ea2e2104b3eeb1a/src/ElasticsearchServiceProvider.php#L93

tintamarre avatar Feb 06 '21 04:02 tintamarre