Laravel collection using where it works only locally and not on the server

I am using Laravel 5 collections. My query is as follows:

$lastplace = collect(@$this->places)->where('type', 'street')->last();

Locally, it will return the correct last element in the array, but on the server it will return null with the exact replica of the database on the local + server.

I am running the Native MySQL driver and I have no problem with any other queries, only on the server.

From ideas ..

+4
source share
2 answers

only 2 cents.

If the database is the same, the code is the same as when setting up the server, check the log to get some pointers. make sure the required PHP extensions are included as mcrypt.

0
source

Try debugging the output step by step:

  • Step

    dd($this->places);

  • Step

    dd($this->places->where('type', 'street'));

0

Source: https://habr.com/ru/post/1653868/


All Articles