entrust icon indicating copy to clipboard operation
entrust copied to clipboard

Deleting event in boot method

Open lotestudio opened this issue 9 years ago • 1 comments

I have an issue when try to add deleting event in boot method of my child class which exteneds User class which use EntrustTrait... :). The event is not fired. I have found the solution completely described here: http://stackoverflow.com/questions/26244817/trouble-with-multiple-model-observers-in-laravel

Maybe 'return true' in EntrustUserTrait.php on line 42 (boot method) must be deleted?

lotestudio avatar Apr 08 '15 08:04 lotestudio

I removed the return true; in public static function boot() and it worked.

The function boot() will be like this:

public static function boot()
    {
        parent::boot();

        self::deleting(function($user) {
            if (!method_exists(Config::get('auth.providers.users.model'), 'bootSoftDeletes')) {
                $user->roles()->sync([]);
            }
        });
    }

henryonsoftware avatar Mar 12 '20 08:03 henryonsoftware