WouterJEloquentBundle icon indicating copy to clipboard operation
WouterJEloquentBundle copied to clipboard

QueryBuilder Result in Array format PDO::FETCH_ASSOC

Open najicham opened this issue 8 years ago • 1 comments

First, thank you so much for making this package, it is amazing!

It would be great to get query builder results as an associative array.

I see in vendor/illuminate/database/Connection.php: line 102: protected $fetchMode = PDO::FETCH_OBJ;

in file vendor/illuminate/database/Capsule/Manager.php: line 47: protected function setupDefaultConfiguration() { $this->container['config']['database.fetch'] = PDO::FETCH_OBJ; $this->container['config']['database.default'] = 'default'; }

Is there currently an easy way to update the Illuminate container config? What do you recommend is the best way to set the database.fetch = PDO::FETCH_ASSOC?

thanks!

najicham avatar Dec 05 '17 06:12 najicham

I'm not entirely sure, but it seems like calling Manager::setFetchMode() should work.

wouterj avatar Dec 05 '17 10:12 wouterj