I need to populate a blade format tag.
I\'m aware of the Model::pluck(\'column1\', \'column2\')
method to populate a select tag.
You could use selectRaw()
:
Model::selectRaw("CONCAT ('column1', 'column2') as columns, id")->pluck('columns', 'id');
Or you could do this manually:
$collection = Model::get(['column1', 'column2', 'id']);
foreach ($collection as $item) {
$plucked[$item->id] = $item->column1 . $item->column2;
}
dd($plucked);