FilamentF
Filament3y ago
3 replies
DianaMujoiu

Specific order for checkbox list

Repeater::make('propertyBedrooms')
                            ->collapsed()
                            ->label('')
                            ->relationship()
                            ->createItemButtonLabel('Add a new bedroom')
                            ->columnSpanFull()
                            ->itemLabel(fn (array $state): ?string => Str::of($state['title'])->title()->replace('_', ' ') ?? null)
                            ->schema([
                                TextInput::make('title'),
                                RichEditor::make('description'),
                                CheckboxList::make('amenities')
                                ->relationship('amenities', 'name')
                                ->columns(4)
                                ->options(RoomAmenity::all()->pluck('name', 'id'))

                            ]),

I have this repeater with checkboxlist. I am adding amenities in a specific order, but the order is not keep after save. How can I solve it? For example I am checking 1 King Bed and then Ensuite Bathroom with shower, vanity and toilet. I need the 1 King Bed to be first in the list
Screenshot_2023-06-21_at_21.41.19.png
Was this page helpful?