PHPackages                             snowrunescape/eloquent-softdeletes - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. snowrunescape/eloquent-softdeletes

ActiveLibrary[Database &amp; ORM](/categories/database)

snowrunescape/eloquent-softdeletes
==================================

Eloquent extension for soft deletes using a status field

1.1.0(5mo ago)117MITPHPPHP &gt;=7.4

Since Jul 21Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/SnowRunescape/eloquent-softdeletes)[ Packagist](https://packagist.org/packages/snowrunescape/eloquent-softdeletes)[ RSS](/packages/snowrunescape-eloquent-softdeletes/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (3)Versions (4)Used By (0)

eloquent-softdeletes
====================

[](#eloquent-softdeletes)

Eloquent Status SoftDeletes is an extension for the Eloquent ORM to enable soft delete functionality using a status field. This approach allows you to mark records as deleted by setting a specific status value, making it easy to manage "deleted" records while keeping them in the database.

Features
--------

[](#features)

- Soft delete records by updating the status field.
- Customize the status value to indicate a soft delete.
- Seamlessly restore soft deleted records.
- Include or exclude soft deleted records in queries.

Installation
------------

[](#installation)

To install this package, use Composer:

```
composer require snowrunescape/eloquent-softdeletes
```

Usage
-----

[](#usage)

Use the SoftDeletes trait in your Eloquent model.

### Example

[](#example)

#### Setting Up Your Model

[](#setting-up-your-model)

To enable status-based soft deletes in your model, use the SoftDeletes trait and define the status field and the value that indicates a soft delete.

```
use Illuminate\Database\Eloquent\Model;
use SnowRunescape\SoftDeletes\SoftDeletes;

class YourModel extends Model
{
    use SoftDeletes;
}
```

#### Soft Deleting a Record

[](#soft-deleting-a-record)

To soft delete a record, use the delete method. This will update the status field to the deleted status value.

```
$model->delete();
```

#### Restoring a Record

[](#restoring-a-record)

To restore a soft deleted record, use the restore method. This will update the status field to a non-deleted status value.

```
$model->restore();
```

#### Querying Soft Deleted Records

[](#querying-soft-deleted-records)

To include soft deleted records in a query, use the withTrashed method.

```
$allRecords = YourModel::withTrashed()->get();
```

To only get soft deleted records, use the onlyTrashed method.

```
$deletedRecords = YourModel::onlyTrashed()->get();
```

To exclude soft deleted records from a query, use the withoutTrashed method (this is the default behavior).

```
$activeRecords = YourModel::withoutTrashed()->get();
```

Contributing
------------

[](#contributing)

Contributions are welcome! Please submit a pull request or open an issue to discuss your ideas.

License
-------

[](#license)

eloquent-softdeletes is made available under the MIT License (MIT). Please see [License File](https://github.com/SnowRunescape/eloquent-softdeletes/blob/master/LICENSE) for more information.

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance70

Regular maintenance activity

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~536 days

Total

2

Last Release

177d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/52182057?v=4)[Bruno Caitano](/maintainers/SnowRunescape)[@SnowRunescape](https://github.com/SnowRunescape)

---

Top Contributors

[![SnowRunescape](https://avatars.githubusercontent.com/u/52182057?v=4)](https://github.com/SnowRunescape "SnowRunescape (5 commits)")[![goul4rt](https://avatars.githubusercontent.com/u/38509926?v=4)](https://github.com/goul4rt "goul4rt (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/snowrunescape-eloquent-softdeletes/health.svg)

```
[![Health](https://phpackages.com/badges/snowrunescape-eloquent-softdeletes/health.svg)](https://phpackages.com/packages/snowrunescape-eloquent-softdeletes)
```

###  Alternatives

[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.4M96](/packages/mongodb-laravel-mongodb)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[watson/validating

Eloquent model validating trait.

9803.5M54](/packages/watson-validating)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)[aimeos/laravel-nestedset

Nested Set Model for Laravel

3714.4k6](/packages/aimeos-laravel-nestedset)[dbout/wp-orm

WordPress ORM with Eloquent.

12910.3k1](/packages/dbout-wp-orm)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
