F
Filamentβ€’9mo ago
Laurens

Disable resource form while editing but enable relation managers?

Is this possible without manually disabling each field? What would be the best approach for this?
4 Replies
Laurens
LaurensOPβ€’9mo ago
Update: we've manually disabled each field in the form for now. Not sure if there is a better way. πŸ€”
dissto
disstoβ€’9mo ago
You could wrap your form inputs in a Group and add ->disabled() on that group, but why?
Group::make([
TextInput::make('bla'),
Select::make('blub'),
])->disabled(),
Group::make([
TextInput::make('bla'),
Select::make('blub'),
])->disabled(),
awcodes
awcodesβ€’9mo ago
$form->disabled()
Yasser
Yasserβ€’9mo ago
Bump. I've also used disabled for this as well. Then I would use a policy as a conditional lfor the form to be disabled.... Trickling down this would conflict with Filemanet inheriting the policies, So I add a custom policy functtion canManageModelFields, canManageModelRelationShips, then the user is allowed to edit the title, yet not the addresses (relation), but tthey are allowed to edit the 'links' relationship.... Sorry for the typos.... It's Friday and I had to deploy today πŸ™‚ To summarize my question on this: Do you have any tips on solving granular customisation through polices in filament (so the rest of my app can follow )? Kind Regards, Y .
Want results from more Discord servers?
Add your server