entrust icon indicating copy to clipboard operation
entrust copied to clipboard

EntrustUserTrait conflicts with Authorizable

Open Stichoza opened this issue 9 years ago • 2 comments

As I debugged, Zizaco\Entrust\Traits\EntrustUserTrait conflicts with Illuminate\Foundation\Auth\Access\Authorizable. Both have can() method.

The fix is to rename can method in EntrustUserTrait to hasPermission or resolve the conflict inside the User class like so:

class User extends Model implements Authentic...
{
    use Authenticatable, Authorizable, CanResetPassword, EntrustUserTrait {
        Authorizable::can insteadof EntrustUserTrait;
        EntrustUserTrait::can as hasPermission;
    }

    ...
}

Stichoza avatar Dec 25 '15 11:12 Stichoza

Thanks for the heads up! Hope this gets accounted for in the next update

dusterio avatar Jan 07 '16 01:01 dusterio

Hello,

this is still a problem, and using insteadof and as statement is useless because can function in entrust is recursive when passing an array of permissions, so the call end up in laravel permission system...

lk77 avatar Mar 02 '18 14:03 lk77