ayoub-amzil/soft-delete-logger 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ayoub-amzil/soft-delete-logger

最新稳定版本:1.1.0

Composer 安装命令:

composer require ayoub-amzil/soft-delete-logger

包简介

Log soft deletes and restore actions on Eloquent models with user tracking in Laravel.

README 文档

README

Log every soft delete and restore action on your Eloquent models — including the authenticated user who performed it.

📦 Installation

composer require ayoub-amzil/soft-delete-logger

🛠️ Setup

1. Publish the migration

php artisan vendor:publish --tag=soft-delete-logger-migrations

Then migrate:

php artisan migrate

2. Add the trait to your model

use AyoubAmzil\SoftDeleteLogger\Traits\LogsSoftDeletes;

class Product extends Model
{
    use SoftDeletes, LogsSoftDeletes;
}

That’s it!

🔍 What it logs

Whenever a model is soft-deleted or restored, it logs:

  • model: Class name of the model
  • model_id: The ID of the deleted/restored record
  • user_id: The ID of the currently authenticated user (or null if not logged in)
  • action: Either soft_deleted or restored
  • timestamps: When the action happened

📄 Log Table Example

id model model_id user_id action created_at
1 App\Models\Post 42 1 soft_deleted ...
2 App\Models\Post 42 1 restored ...

✅ Compatibility

  • Laravel 10+
  • Works with any model using SoftDeletes

📄 License

MIT

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-26