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

lara68236's avatar

Query results to array without key

How do I query a table for only the ID, and have it return an array without keys, and only the IDs. For example, I want an array like 1, 2, 3, 65, 77, 190, 234 .....

Thanks

0 likes
2 replies
Snapey's avatar
Snapey
Best Answer
Level 122
Model::where('something',$something)->pluck('id');
1 like

Please or to participate in this conversation.