maryamfadhillah/soft-delete-extra
最新稳定版本:v1.0.0
Composer 安装命令:
composer require maryamfadhillah/soft-delete-extra
包简介
Laravel package for extended soft delete with deleted_by
README 文档
README
A simple Laravel package that override the default SoftDeletes functionality by adding custom fields such as is_deleted and deleted_by without keeping deleted_at from Laravel's native implementation.
Features
- Automatically fills:
is_deleted→ mark row as deleted (1 = deleted, 0 = active).deleted_by→ stores the user ID who deleted the record.
- Can be reused across multiple models using a single trait.
Requirement
- PHP 8.0
- Laravel 10
Installation
- Install via Composer:
composer require maryamfadhillah/soft-delete-extra
- Add the trait to your Model
use Illuminate\Database\Eloquent\Model;
use App\Traits\SoftDeleteExtra;
class Product extends Model
{
use SoftDeleteExtra;
protected $fillable = [
'name',
'deleted_by',
'is_deleted',
// ...
];
}
Database Requirement
Make sure your table contains the following columns in addition to your normal fields:
ALTER TABLE products
ADD deleted_by INT NULL,
ADD is_deleted TINYINT DEFAULT 0;
Usage
It's completely the same as Laravel's Soft Delete.
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2025-09-20