I\'m trying to convert a query to an array with the method toArray() but it doesn\'t work for the query builder. Any ideas for convert it?
toArray()
Example
Easiest way is using laravel toArray function itself:
$result = array_map(function ($value) { return $value instanceof Arrayable ? $value->toArray() : $value; }, $result);