it is possible to make badges with link for each badge

I want to ask it is possible to make badges in table that have multiple url link for each badge? If it is possible how to do that? Thank you
Solution:
```php Tables\Columns\TextColumn::make('inventory_location_list.inventory_location.room_name') ->searchable()
->badge() ->limitList(3)...
Jump to solution
5 Replies
Dennis Koch
Dennis Koch2mo ago
Did you try using the ->url() method when state is an array? If that doesn’t work, then probably no option apart from using a ViewColumn
thyk123
thyk1232mo ago
yes i try using url, but it null with this code
Tables\Columns\TextColumn::make('inventory_location_list.inventory_location.room_name')
->searchable()
->badge()
->limitList(3)
->expandableLimitedList()
->url(function ($state): string {
// dd($state);
return InventoryLocationResource::getUrl('edit', ['record' => $state->inventory_location]);
})
->label('At Room'),
Tables\Columns\TextColumn::make('inventory_location_list.inventory_location.room_name')
->searchable()
->badge()
->limitList(3)
->expandableLimitedList()
->url(function ($state): string {
// dd($state);
return InventoryLocationResource::getUrl('edit', ['record' => $state->inventory_location]);
})
->label('At Room'),
if i only using
InventoryLocationResource::getUrl('edit', ['record' => $state]);
InventoryLocationResource::getUrl('edit', ['record' => $state]);
it shows this
Missing required parameters for [Route: filament.admin.resources.inventory-locations.edit] [URI: admin/inventory-locations/{record}/edit] [Missing parameters: "id":1,"inventory_location_id":"01hxgz0mfew7f82z6ss0e82egw","inventory_id":"01hxgy0f0z96rbppw5jqgg552a","status":"Excellent","qty":"1","note":null,"created_at":"2024-05-10T10:43:04.000000Z","updated_at":"2024-05-10T10:43:04.000000Z","deleted_at":null,"inventory_location":{"id":"01hxgz0mfew7f82z6ss0e82egw","room_name":"room test","room_status":"occupied","occupied_by":"test","user_id":1,"deleted_at":null,"created_at":"2024-05-10T09:58:10.000000Z","updated_at":"2024-05-10T09:58:10.000000Z", "id":2,"inventory_location_id":"01hxgyzb4mv113ja5fd37h81h2","inventory_id":"01hxgy0f0z96rbppw5jqgg552a","status":"good","qty":"1","note":null,"created_at":"2024-05-10T12:46:22.000000Z","updated_at":"2024-05-10T12:46:22.000000Z","deleted_at":null,"inventory_location":{"id":"01hxgyzb4mv113ja5fd37h81h2","room_name":"room test 2","room_status":"occupied","occupied_by":"test","user_id":1,"deleted_at":null,"created_at":"2024-05-10T09:57:28.000000Z","updated_at":"2024-05-10T12:46:22.000000Z"].
Missing required parameters for [Route: filament.admin.resources.inventory-locations.edit] [URI: admin/inventory-locations/{record}/edit] [Missing parameters: "id":1,"inventory_location_id":"01hxgz0mfew7f82z6ss0e82egw","inventory_id":"01hxgy0f0z96rbppw5jqgg552a","status":"Excellent","qty":"1","note":null,"created_at":"2024-05-10T10:43:04.000000Z","updated_at":"2024-05-10T10:43:04.000000Z","deleted_at":null,"inventory_location":{"id":"01hxgz0mfew7f82z6ss0e82egw","room_name":"room test","room_status":"occupied","occupied_by":"test","user_id":1,"deleted_at":null,"created_at":"2024-05-10T09:58:10.000000Z","updated_at":"2024-05-10T09:58:10.000000Z", "id":2,"inventory_location_id":"01hxgyzb4mv113ja5fd37h81h2","inventory_id":"01hxgy0f0z96rbppw5jqgg552a","status":"good","qty":"1","note":null,"created_at":"2024-05-10T12:46:22.000000Z","updated_at":"2024-05-10T12:46:22.000000Z","deleted_at":null,"inventory_location":{"id":"01hxgyzb4mv113ja5fd37h81h2","room_name":"room test 2","room_status":"occupied","occupied_by":"test","user_id":1,"deleted_at":null,"created_at":"2024-05-10T09:57:28.000000Z","updated_at":"2024-05-10T12:46:22.000000Z"].
Dennis Koch
Dennis Koch2mo ago
I am not sure then.
Solution
toeknee
toeknee2mo ago
Tables\Columns\TextColumn::make('inventory_location_list.inventory_location.room_name')
->searchable()
->badge()
->limitList(3)
->expandableLimitedList()
->url(function ($record): string {
// dd($state);
return InventoryLocationResource::getUrl('edit', ['record' => $record]);
})
->label('At Room'),
Tables\Columns\TextColumn::make('inventory_location_list.inventory_location.room_name')
->searchable()
->badge()
->limitList(3)
->expandableLimitedList()
->url(function ($record): string {
// dd($state);
return InventoryLocationResource::getUrl('edit', ['record' => $record]);
})
->label('At Room'),
thyk123
thyk1232mo ago
Many Thanks!