Reputation: 403
I am using pluck method to get data from single column
$systems = OptionUser::pluck('user_skill');
This systems variable returning only one value while I have around 50 values in this table. Please suggest what is correct way to get all the data from this column.
Upvotes: 1
Views: 9326
Reputation: 11
It will work.
$systems = OptionUser::select('user_skill')->get();
Upvotes: 0
Reputation: 3515
I know it's late but still if someone need it.
For laravel 4.2 lists
will work.
Try this : OptionUser::lists('user_skill');
Note:
The following features are deprecated in 5.2 and will be removed in the 5.3 release in June 2016
The lists method on the Collection, query builder and Eloquent query builder objects has been renamed to pluck. The method signature remains the same.
Upvotes: 2
Reputation: 461
please use get
(which returns simple array of stdObjects) instead of pluck
(which returns single value - string by default) in laravel 5.4, because of pluck only gives single value from database
$systems = OptionUser::select('user_skill')->get();
Upvotes: 7