Middleware/restriction to specific setting
Hi, new to filament and having some issues with restricting users' abilities to edit specific settings.
As a background I'm using spatie's laravel-permission package along with the spatie roles plugin for filament. Now the permissions are working well for things like "edit user" etc - but, i'd like to create a specific rule for a specific field in the user resource, but can't find how to do that. So for example I have a specific field that is maybe "user_email", and then I'd like to have it so that an admin might have the permission to "edit user", but also need the permission to "edit user email", otherwise the email field should be hidden.
Note: I'm not really looking for a solution specific for spatie although that's great, but mainly just the generally approach that should be used to go about doing this.
Basically looking for something like this:
Forms\Components\TextInput::make('email')
->email()
->middleware($user->can('edit user email')
Any pointers on what I could use (instead of ->middleware(), since it's not available...) is much appreciated
2 Replies