Check if value is true, and check the checkbox on update
I have a multi tenancy setup. But when i want to edit an tenancy I want to have all checkboxes checked if they are true in the json object from the database.
How can I do this?
So if in this example twitter is true, then I want to have the checkbox for twitter checked. Is this possible?
4 Replies
Is settings a relationship to the model or a db column on the model.?
It is a db column
I've already tried it with using
->default([false, false, true, false, false])
but that doesn't worki would create a record through the filament form to see exactly how the data is stored in the db, then use that to reconstruct it where you need to. Also keep in mind that
->default()
only works in the 'create' context. So you can't use it to prefil the field in the 'edit' context.I've created this one (from the example) through the form. Or I don't understand it that is also possible π
Didn't know what happened but now, with a fresh database it works. So yeah either way, thanks for the suggestions!