fix! добавлено удаление всех ролей пользователей при удалении
This commit is contained in:
parent
c9892c33a5
commit
c3caf80678
@ -104,4 +104,14 @@ public function roles(): HasManyThrough
|
||||
);
|
||||
}
|
||||
|
||||
protected static function booted()
|
||||
{
|
||||
static::deleted(function (User $user)
|
||||
{
|
||||
foreach ($userRoles = UserRole::where('user_id', $user->id)->get() as $userRole) {
|
||||
$userRole->delete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user