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 modelmodel_id: The ID of the deleted/restored recorduser_id: The ID of the currently authenticated user (ornullif not logged in)action: Eithersoft_deletedorrestoredtimestamps: 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
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-07-26