entrust
entrust copied to clipboard
Deleting event in boot method
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?
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([]);
}
});
}