Support the ongoing development of Laravel.io →
Database Configuration Eloquent
Last updated 2 years ago.
0

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: http://laravel.com/docs/5.1/helpers#method-array-only

Hope it works.

Last updated 9 years ago.
0

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 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

sstringer sstringer Joined 2 Dec 2014

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.