Abhay PS
Abhay PS

Reputation: 4175

Laravel 4 - I want to extract all emails from users table to an array

I have a model called User which contains emails and names. I want to extract all the email from this model to an array. Does anyone has any idea how can I do this in simplest form possible ?

Upvotes: 0

Views: 243

Answers (1)

citizenkane
citizenkane

Reputation: 36

User::get(['email'])->toArray()

Also remember that array shorttags are for PHP 5.4+

Upvotes: 2

Related Questions