nova-bouncer
nova-bouncer copied to clipboard
Feature request: 'Applied to' field for Roles resource
I've been trying to figure out how to add a field that displays all the models that a Role
has been applied to. I know it should be roughly the inverse of the MorphToMany
used in my User
resource:
MorphToMany::make('Roles', 'roles', Role::class)->fields(
static fn() => [
Text::make('Scope')
->sortable()
->rules('nullable', 'integer'),
]
),
However, I'm failing dismally at trying to see how to define a field for "things that this Role is applied to" since obviously it doesn't have a single class name that I can give it. I can see the records in the assigned_roles
table that represent this linkage, but can't spot a corresponding relation in Bouncer to use in the MorphToMany
.
I'm hoping that you have a better understanding of this!