fix! добавлено удаление всех ролей пользователей при удалении

This commit is contained in:
developer 2026-01-22 17:04:28 +08:00
parent c9892c33a5
commit c3caf80678

View File

@ -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();
}
});
}
} }