concatenate fields on a select options
I am trying and to concatenate the name and rate fields for a select options
I tried
->getOptionLabelUsing(fn ($value): ?string => Tax::find($value)?->name. ' - '. Tax::find($value)?->rate. '%')
which doesnt work
any clues please π
Solution:Jump to solution
got it for anyone else in the future
``` Tax::all()->map(function ($tax) {
return [
'value' => $tax->id,
'label' => $tax->name . ' - ' . $tax->rate . '%',...
5 Replies
Solution
got it for anyone else in the future
there is a better way
virtual col, or getOptionLabelFromRecordUsing()
@Dan Harrin yet again your genius is oustanding π
TY