F
Filamentβ€’7mo ago
GDG

3.2.79 appears to have broken Select that aren't multiple (Not sure if this is specific to Shield)

In 3.2.78 this worked fine Forms\Components\Select::make('roles')->label('User Role')->relationship('roles', 'name')->preload()->searchable(), but in 3.2.79, when attempting to save my user with a role, I receive the following error array_diff(): Argument #2 must be of type array, string given If I change my Select to have ->multiple() then it works again but obviously then has the side effect of letting multiple be selected. Playing around with this a bit, if I save my user with the Select containing ->multiple() with 1 entry and then remove ->multiple() go into my user and change the role then it saves just fine but if I remove all role associations to my user, save, then try to add a role back and save, then the error appears again. I can see there was some changes to Select and CheckboxList in 3.2.79 so it is either something broke it there OR I need to be doing something different here now to accommodate for the changes made. Can keep as a multiple for now as I develop the rest but I would be keen to understand if I am doing something wrong here πŸ™‚
3 Replies
Alex Manase
Alex Manaseβ€’7mo ago
I have the same issue.
Tally
Tallyβ€’7mo ago
:squint: have a similar issue using
Forms\Components\ToggleButtons::make('test')
->label('Test')
->multiple()
->options([
'one', 'two', 'three', 'four', 'five',
]),
Forms\Components\ToggleButtons::make('test')
->label('Test')
->multiple()
->options([
'one', 'two', 'three', 'four', 'five',
]),
In the livewire debug I see that data.test is null instead of []
Dennis Koch
Dennis Kochβ€’7mo ago
Please open an issue on GitHub
Want results from more Discord servers?
Add your server