Organizing a collection
Tables\Columns\TextColumn::make('userLocations')
->label('Locations')
->searchable()
->sortable()
->badge()
->formatStateUsing(
fn(Model $record) => $record->userLocations->map(
fn($location) => $location->country->name . ' ' . $location->state->name
)->implode(PHP_EOL)
)Tables\Columns\TextColumn::make('userLocations')
->label('Locations')
->searchable()
->sortable()
->badge()
->formatStateUsing(
fn(Model $record) => $record->userLocations->map(
fn($location) => $location->country->name . ' ' . $location->state->name
)->implode(PHP_EOL)
)so I have this code. and i wanted the output to be like:
Botswana Chobe
Andorra EncampBotswana Chobe
Andorra Encampbut the output i get is
Botswana Chobe Andorra Encamp
Botswana Chobe Andorra EncampBotswana Chobe Andorra Encamp
Botswana Chobe Andorra Encamp