basemkhirat / elasticsearch

The missing elasticsearch ORM for Laravel, Lumen and Native php applications
MIT License
401 stars 130 forks source link

Class starts_with not found #121

Open saguajardo opened 3 years ago

saguajardo commented 3 years ago

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
    ]);

}

}`

tintamarre commented 3 years ago

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