Custom Toggle

Is it possible to obtain the current record and the state of the toggle, true or false, in order to perform operations when saving or updating the form, so that based on that record and toggle state, custom operations can be performed, such as creating or editing other different models and the database? Forms\Components\Toggle::make('custom'),
Solution:
you can work with toggle, but I think you should use some methods to customize data before filling the form and before saving it to the database Check this section for EditPage: https://filamentphp.com/docs/3.x/panels/resources/editing-records#customizing-data-before-filling-the-form...
Jump to solution
4 Replies
LeandroFerreira
LeandroFerreira2mo ago
Could you explain what are you trying to do?
AaronFarm
AaronFarm2mo ago
Good afternoon. In my db, there's a model that has many options. For an admin, Select->multiple() works well, but there's another user with a different role who should only be able to add or remove a specific option from the model. I thought about using a toggle, but I'm not sure how to implement it
Solution
LeandroFerreira
LeandroFerreira2mo ago
you can work with toggle, but I think you should use some methods to customize data before filling the form and before saving it to the database Check this section for EditPage: https://filamentphp.com/docs/3.x/panels/resources/editing-records#customizing-data-before-filling-the-form
Want results from more Discord servers?
Add your server