Endocrine
Endocrine
FFilament
Created by Endocrine on 1/13/2025 in #❓┊help
How to lock table records from being selected, depending on other selected Records
What I am trying to do: I have a hierarchical structure of groups (example slugs): - GroupA - GroupA/GroupB - GroupA/GroupC I have a bulk action that sends a request to change the permission of a user of any group, but permissions are also inherited -> GroupA permissions also count for B, C but B, C do not count for each other or A. The requirement I am facing is, that when any of those related groups are selected for the Bulk Action via the Resource Table (checkbox), the other related groups will not be selectable anymore and greyed-out or have a "-" in the checkbox or sth to signify, that they are not selectable anymore. (e.g.: Select A -> B and C are not selectable anymore) I tried to find some kind of hook or event that gets fired when a record is selected for a bulk action, but wasn't able to find anything. I would be very grateful, if somebody could point me in the right direction of where to start to look. Just as a hint where we are in the code:
class MyResource extends Resource
{
//...
public static function table(Table $table): Table
{
// ...
->bulkActions(
[
Tables\Actions\BulkAction::make('Bearbeiten')
->form(
[
Select::make(self::USER_STRING)
->options(fn() => $allMembers->pluck('name', 'id')),
Select::make(self::ACCESS_STRING)
->options(self::ACCESS_LEVELS)
]
)
//...
}
}
class MyResource extends Resource
{
//...
public static function table(Table $table): Table
{
// ...
->bulkActions(
[
Tables\Actions\BulkAction::make('Bearbeiten')
->form(
[
Select::make(self::USER_STRING)
->options(fn() => $allMembers->pluck('name', 'id')),
Select::make(self::ACCESS_STRING)
->options(self::ACCESS_LEVELS)
]
)
//...
}
}
2 replies