Skip to content
Advertisement

Cannot use object of type IlluminateDatabaseQueryBuilder as array

I cannot find the error here how do i fix this?

Advertisement

Answer

The method groupBy() returns a QueryBuilder to convert it to an array call get() to receive an array of rows.

Thou you need to deal with the query returning multiple rows, so an quick solution for that would to traverse db2 with foreach().

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement