Level 104
Collection also has a pluck method:
$collection->pluck('email')
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have an Illuminate\Support\Collection instance after getting the data.
The structure is an array:
#items => array: 400
0 =>
id: <some_id>
email: <some_email>
1 =>
id: <some_id>
email: <some_email>
2 =>
id: <some_id>
email: <some_email>
.. and more ..
How can I get for example all the emails as an array properly? I need the rest of the columns as well that's why I am not using pluck
Collection also has a pluck method:
$collection->pluck('email')
Please or to participate in this conversation.