Skip to content
Advertisement

Cannot convert to integer from illuminate

I retrieve data:

JavaScript

However, it failed at the $count < $credit, error Object of class IlluminateSupportCollection could not be converted to int, I tried putting ->first(); got same thing

Advertisement

Answer

->get() will return the collection.

->first() instead of ->get() return the query builder stdClass of expert table.

So you need to call its attribute like this:

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