Support the ongoing development of →
Database Configuration Eloquent
Last updated 10 months ago.

Possibly the array helpers are the solution.

$response = .... //The result of the query.

array_only(range(0,(sizeof($response)/2)-1). In this case you are obtaining only all the index from 0 to n/2 -1

Details here:

Hope it works.

Last updated 7 years ago.

Thanks, @JuanDMeGon.

Actually, I was looking to accomplish the opposite (weed out the integer-based keys), but I see that array_except would be the solution there. Using helper functions is a good idea that I'll look into.

But I was hoping to find a way to turn this "feature" off at the source in the Laravel/Lumen DB facade itself. I can't imagine why this would be on by default, so I'm wondering if I've set something up incorrectly.

Thanks, Steve

Last updated 7 years ago.

Sign in to participate in this thread!


Your banner here too?

sstringer sstringer Joined 2 Dec 2014


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2023 - All rights reserved.