badge with link and show name instead id

Hello everyone! Have a nice weekend!

I want to ask about my code here below
 Tables\Columns\TextColumn::make('inventory_location_list.inventory_location.id')
                    ->searchable()   
                    ->badge()
                    ->url(function ($state): string {
                        return  InventoryLocationResource::getUrl('edit', ['record' => $state[0]]);
                    })
                    ->separator(',')
                    ->label('At Room'),


firstly I want to make each badge from the relationship have a link, not only 1 link but multiple links from how much data from the relationship
second, I want to show
inventory_location.room_name
instead
inventory_location.id
but still want to get the id for link the URL each badge

how can I do that?

Thank you!
Solution
and the record will give you the entire model instance that you can extract the correct data from
Was this page helpful?