maryamfadhillah / soft-delete-extra
There is no license information available for the latest version (v1.0.0) of this package.
Laravel package for extended soft delete with deleted_by
Package info
github.com/maryamfadhillah/soft-delete-extra
pkg:composer/maryamfadhillah/soft-delete-extra
v1.0.0
2025-09-20 07:40 UTC
Requires
- php: ^8.0
- illuminate/support: ^10.0
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.