Reputation: 59
Is it possible to generate new fields in a form based on a checkBoxList in filament dynamically, Lets say I have a product and I checked the color option on it then an input field appear to add the value to that color.
Thanks in advance.
Upvotes: 1
Views: 19290
Reputation: 87
If you want hidden from a user that is not admin (is_admin column is 0):
Toggle::make('column')->hidden(fn(callable $get) => Auth::user()->is_admin == 0);
Of course that you have create column name is_admin(tinyint or boolean) to do this
Upvotes: 0
Reputation: 33
A little late on this, but I did it making the hidden property change dynamically.
Toggle::make('column')->hidden(function (callable $get) {
if ($get('other_column') == 'x') {
return false;
} else {
return true;
}
})
The 'other_column' must have the reactive() method.
Upvotes: 3