Skip to content

Fix issue using query builder first() method (in case with usage outside the Laravel) #1583

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 16, 2018

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