Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

MrThunder's avatar

Eloquent Query is Pulling in a Ton of Bogus Records

The query is: $fragments = Fragment::where('seed_id', $seed_id)->orderBy('position', 'ASC')->get();

When I go and actually check the database the correct number of records are present (4). When the above query is executed it returns 40+, and isn't consistent, it's returned as many as 70. I outputted the data, and the new "bogus" entries are the original 4 with the correct data, but new ids.

Any ideas?

Thanks, Mark

0 likes
3 replies
bobbybouwmann's avatar

It looks like you're creating data while you are fetching it? It doesn't just magically change IDs!

Can you show a bit more code?

1 like
MrThunder's avatar

Hi Bobby,

I was checking the wrong db, just started using Laravel forge and realized it wasn't doing a refresh every time it pulled from source.

Sorry about that!

Please or to participate in this conversation.