bouncer icon indicating copy to clipboard operation
bouncer copied to clipboard

How to override "assigned_roles" model ?

Open ghost opened this issue 6 years ago • 4 comments

Hi,

I'd like to override "assigned_roles" model to add Auditable trait (which add timestamps and ID of user responsible of action on the model) but I don't find any Model for tables others than Ability and Role.

How can I override other Bouncer Models ?

regards

ghost avatar Nov 01 '19 13:11 ghost

And same question for "permissions" model ?

wikiki avatar Nov 03 '19 17:11 wikiki

I don't think you can at the moment. Looking closer at the code those tables are hardcoded.

If you look at this file: src/Conductors/AssignsRoles.php

You'll see the following function at the end

    protected function newPivotTableQuery()
    {
        return Models::query('assigned_roles');
    }

The same goes with permissions sadly.

grenadecx avatar Nov 04 '19 14:11 grenadecx

@JosephSilber : Any chance to have Models for those table soon ? Could be very useful to be able to override them to handle custom data like (sofdeletes, ...) on abilities assignment ....

wikiki avatar Nov 04 '19 19:11 wikiki