Friday, March 9, 2018

Laravel ::pluck multiple columns - development

Laravel ::pluck multiple columns

I need to populate a blade format <select> tag.

I’m aware of the Model::pluck('column1', 'column2') method to populate a select tag.

But in my case, I have to concatenate two columns , and get the id. something like

Model::pluck('column_1 && column_2', 'id')

Is it possible like that ? If yes, what would be the proper syntax?

If not, what would be the best alternative then ?



from Laravel Questions and Answers https://laravelquestions.com/laravel/laravel-pluck-multiple-columns/
via Lzo Media

No comments:

Post a Comment