Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: 'Applied to' field for Roles resource #24

Open
Synchro opened this issue Dec 13, 2022 · 0 comments
Open

Feature request: 'Applied to' field for Roles resource #24

Synchro opened this issue Dec 13, 2022 · 0 comments

Comments

@Synchro
Copy link

Synchro commented Dec 13, 2022

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant