Custom option label in multiple select

I have tried getOptionLabelUsing and getOptionLabelFromRecordUsing() both but my the options are not as I wanted. I have faced this when the select field is multiple.

getOptionLabelFromRecordUsing() this works in single select option but not in multiple
Solution
Instead of pluck, use map with keys, eg:
          ->options(function () {
            return Model::all()->mapWithKeys(function ($model) {
              return [$model->id => $model->name . $model->id ...];
              });
          })
Was this page helpful?