Convert Repeater to a Multiple Select Field

I have a 'postCategories' Pivot relationship. I already prepared the Models and Relationships as they mentioned in the Doc. The repeater works fine as expected. Is there any way to convert this Repeater field to a multiple-select field? So then it's looks cleaner than a repeater. Because i don't have extra data fields on my pivot table. Just 'post_id' and 'category_id'.

 Forms\Components\Repeater::make('postCategories')
   ->relationship()
    ->schema([
        Select::make('category_id')
            ->label('Category')
            ->options(Category::all()->pluck('name', 'id'))
            ->searchable()->preload()
            ->required()
      ->disableOptionsWhenSelectedInSiblingRepeaterItems()
])->minItems(1)
Solution
The categories must be a BelongsToMany?
Was this page helpful?