filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
19.39k stars 2.97k forks source link

Add nestedRecursiveRules to ToggleButtons #14815

Closed tanthammar closed 3 days ago

tanthammar commented 6 days ago

Description

This PR adds the missing trait to be able to define array rules on ToggleButtons::make('foo')->multiple()

danharrin commented 4 days ago

Can you please specify which rules would work well on this field? Since these are pre-defined options and not variable like TagsInput

tanthammar commented 4 days ago

Here is an example:

ToggleButtons::make('booked_seat_id')
      ->multiple()
      ->inline()
      ->grouped()
      ->options($booking->bookedSeats->pluck('bookable.name', 'id'))
      ->nestedRecursiveRules(Rule:in($booking->bookedSeats->pluck('id')->toArray()))