Skip to content

Conversation

@bTokman
Copy link

@bTokman bTokman commented Aug 16, 2018

In my case when i using the query builder outside the Laravel app i catching error

Fatal error: Uncaught Error: Call to a member function first() on array in /application/vendor/illuminate/database/Concerns/BuildsQueries.php on line 77

In the new versions of illuminate/database BuildsQueries first() method looks like

public function first($columns = ['*'])
    {
        return $this->take(1)->get($columns)->first();
    }

So it means that get() method must return collection not the array. I made the simple change that would fix this issue.

@jenssegers jenssegers merged commit bc78c75 into mongodb:master Aug 16, 2018
mnphpexpert added a commit to mnphpexpert/laravel-mongodb that referenced this pull request Sep 2, 2024
Fix issue using query builder first() method (in case with usage outside the Laravel)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants