entrust: Conflict of EntrustUserTrait with SoftDeleteTrait

It seems like 12c4eb09a376db64e6ebc5d08520050bc589a542 added in restore as a method to the EntrustUserTrait. However, this causes the trait to conflict with SoftDeleteTrait.

Trait method restore has not been applied, because there are collisions with other trait methods on App\Models\User

A class that exhibits this is pretty simple.

class User extends Model {
    use SoftDeletes;
    use EntrustUserTrait;
}

Perhaps the documentation should be updated with…

class User {
    use SoftDeletes { restore as private restoreA };
    use EntrustUserTrait { restore as private restoreB };
}

and add a method that calls both to the user trait… But really I think this whole solution is hacky.

These should be enabled and bound to the proper events rather than attempted to be overriden in the methods via the traits. restore could be bound to the restored event, for instance.

About this issue

  • Original URL
  • State: open
  • Created 9 years ago
  • Reactions: 4
  • Comments: 16 (5 by maintainers)

Commits related to this issue

Most upvoted comments

@Mahmoudz It looks like this project is not being maintained anymore by @Zizaco so I moved to Laratrust. It is a fork of this project maintained by @santigarcor

Waiting for this to get fixed.

Edit: Found a clean and less messy way to fix this: #480

Wow, this is waaaay back 2015 and a major issue. Kudos to the author for building this package but this issue like this should be resolved. Going with LaraTrust now.

The problem’s messing with my user class and i’m not even using the SoftDeleting trait. It’ll be nice if the fix is merged quickly.

Thanks.

M

Why hasn’t https://github.com/Zizaco/entrust/pull/430 been accepted and merged yet? 😦 Seems there are a lot of open issues.