There doesn't seem to be an easy way to limit the roles / permissions that are available for selection in a BooleanGroup. I've done it my project by extending RoleBooleanGroup but it's not pretty as I have to duplicate some of the logic from the constructor and $this->options() is called twice.
It would be nice if RoleBooleanGroup and PermissionBooleanGroup had an optionsQuery method, similar to the way Nova Resources work - this could then be overridden in subclasses as needed.
Additionally, there's no validation that the values passed in are valid - it would be good to provide a validation rule.
My use case is I have multiple organisations that can sign up, but different organisations should have access to different roles. I can create a PR if you're interested.
There doesn't seem to be an easy way to limit the roles / permissions that are available for selection in a BooleanGroup. I've done it my project by extending
RoleBooleanGroup
but it's not pretty as I have to duplicate some of the logic from the constructor and$this->options()
is called twice.It would be nice if
RoleBooleanGroup
andPermissionBooleanGroup
had anoptionsQuery
method, similar to the way Nova Resources work - this could then be overridden in subclasses as needed.Additionally, there's no validation that the values passed in are valid - it would be good to provide a validation rule.
My use case is I have multiple organisations that can sign up, but different organisations should have access to different roles. I can create a PR if you're interested.