If you like regular queries, laravel has getPdo(). Also see https://laracasts.com/discuss/channels/laravel/dbsetfetchmodepdofetch-assoc-in-laravel-53
Any way to configure PDO::FETCH_ASSOC?
I'm in the middle of a project originally started on 5.2.
I prefer to use the query builder and am NOT using Eloquent (nor will I ever).
I also prefer the query builder to return simple arrays, not arrays of stdClass objects, nor collections because again, I prefer to work with simple arrays.
I originally added:
'fetch' => PDO::FETCH_ASSOC
to config/database.php and have been working with simple arrays successfully for months. I upgraded to 5.4, which includes the change in 5.3 that apparently modified the query builder to return a collection.
The 5.3 upgrade guide said if I wanted the query builder to continue to return arrays I could chain the add() method to the end of each DB query. An annoying inconvenience, but doable...or so I thought. When I do that, I now get an array of stdClass objects, and not an array of simple arrays as I expect.
I've searched all over, and the usual answers are "can't be done" and "why would you want to do that?", neither of which answer my question, which is:
How do I get the query builder in 5.3 or 5.4 to return simple arrays again?
Please or to participate in this conversation.