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

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/maryamfadhillah/soft-delete-extra

v1.0.0 2025-09-20 07:40 UTC

This package is auto-updated.

Last update: 2025-12-22 02:44:55 UTC


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

  1. Install via Composer:
composer require maryamfadhillah/soft-delete-extra
  1. 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.