PHPackages                             nowendwell/laravel-archivable - 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. nowendwell/laravel-archivable

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

nowendwell/laravel-archivable
=============================

A trait to make an Eloquent model archivable

v1.0.1(7y ago)31.1k1MITPHPPHP ^7.1

Since Mar 13Pushed 7y ago1 watchersCompare

[ Source](https://github.com/nowendwell/laravel-archivable)[ Packagist](https://packagist.org/packages/nowendwell/laravel-archivable)[ Docs](https://github.com/nowendwell/laravel-archivable)[ RSS](/packages/nowendwell-laravel-archivable/feed)WikiDiscussions master Synced 2mo ago

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

A trait to make Eloquent models archivable
==========================================

[](#a-trait-to-make-eloquent-models-archivable)

[![Latest Version on Packagist](https://camo.githubusercontent.com/3434175d8650e2484474ddb99109ba2a1aa60dc209959f353456bd36a1297d5f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6f77656e6477656c6c2f6c61726176656c2d61726368697661626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nowendwell/laravel-archivable)[![Total Downloads](https://camo.githubusercontent.com/160f7d8d74d7d694e6a5ed0afe6d8c8def600274e2b598aa3f64a4820a52eabe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6f77656e6477656c6c2f6c61726176656c2d61726368697661626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nowendwell/laravel-archivable)

This package contains a trait to make Eloquent models archivable. This works in a similar way to the SoftDelete trait that Laravel ships with.

Once you have applied to the trait to a model you can do the following:

```
// to archive a User
$user = User::find(1);
$user->archive();

// to unarchive a User
$user = User::withArchived()->find(1);
$user->unarchive();
```

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

[](#installation)

You can install the package via composer:

```
composer require nowendwell/laravel-archivable
```

Making a model archivable
-------------------------

[](#making-a-model-archivable)

To make model archivable add the `Nowendwell\LaravelArchivable\Archivable` trait to the model you wish to archive

```
use Illuminate\Database\Eloquent\Model;
use Nowendwell\LaravelArchivable\Archivable;

class User extends Model
{
    use Archivable;
}
```

Usage
-----

[](#usage)

This traits adds a Global Query Scope to exclude any models that have a value in the `archived_at` column.

### Archiving

[](#archiving)

```
// to archive a User
$user = User::find(1);
$user->archive();
```

### Unarchiving

[](#unarchiving)

```
// to unarchive a User
$user = User::withArchived()->find(1);
$user->unarchive();
```

### Checking Archive Status

[](#checking-archive-status)

```
// to unarchive a User
$user = User::withArchived()->find(1);
var_dump( $user->archived() ); // bool true/false
```

### Query Scopes

[](#query-scopes)

```
User::withArchived()->get(); // returns all users
User::withOutArchived()->get(); // returns users that are not archived, same results as User::all()
User::onlyArchived()->get() // returns only users that have a value in the archived_at column
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Ben Miller](https://github.com/nowendwell)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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 ~22 days

Total

2

Last Release

2594d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5315824?v=4)[Ben Miller](/maintainers/nowendwell)[@nowendwell](https://github.com/nowendwell)

---

Top Contributors

[![bmillertitul](https://avatars.githubusercontent.com/u/54295408?v=4)](https://github.com/bmillertitul "bmillertitul (1 commits)")[![nowendwell](https://avatars.githubusercontent.com/u/5315824?v=4)](https://github.com/nowendwell "nowendwell (1 commits)")

---

Tags

archivehacktoberfestlaraveltraitlaravelarchiveeloquenttraitlaravel-archivablenowendwellarchivable

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nowendwell-laravel-archivable/health.svg)

```
[![Health](https://phpackages.com/badges/nowendwell-laravel-archivable/health.svg)](https://phpackages.com/packages/nowendwell-laravel-archivable)
```

###  Alternatives

[cybercog/laravel-ban

Laravel Ban simplify blocking and banning Eloquent models.

1.1k651.8k11](/packages/cybercog-laravel-ban)[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)[rtconner/laravel-likeable

Trait for Laravel Eloquent models to allow easy implementation of a 'like' or 'favorite' or 'remember' feature.

394388.0k5](/packages/rtconner-laravel-likeable)[cybercog/laravel-ownership

Laravel Ownership simplify management of Eloquent model's owner.

9126.6k3](/packages/cybercog-laravel-ownership)[devdojo/laravel-reactions

3529.7k](/packages/devdojo-laravel-reactions)

PHPackages © 2026

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