Select option Concat

I want to show options with item_price and item_number combine

like below

J94UUdLL-(5000)
Solution
In options you can return any array/collection so you just need to write your own logic in there to get an array of keys/values as you would any other way in PHP/Laravel.

You could use mapWithKeys to achieve this, something like this would work:
Select::make('author_id')
    ->label('Author')
    ->options(Lead::all()->mapWithKeys(function ($lead) {
        return [$lead->id => $lead->lead_name.'-('.$lead->lead_price.')'];
    }))
Was this page helpful?