News

Archive Eloquent Models with the “Archivable” Package

Published
Archive Eloquent Models with the “Archivable” Package image

The Laravel Archivable package by Joel Butcher is a simple package for making Eloquent models “archivable.” After adding the Archivable tait to your model(s), you have access to various macros:

$user = User::first();
 
// Archive a user
$user->archive();
// Remove user from the archive
$user->unArchive();
 
// Include archived users
$usersWithArchived = User::query()->withArchived();
 
// Only archived users
$onlyArchivedUsers = User::query()->onlyArchived();

Though the examples use the User model, this trait could be useful for things like a Ticket model or a Conversation model, or anywhere you have an archive feature to hide models from active model lists.

You can learn more about this package, get full installation instructions, and view the source code on GitHub at joelbutcher/laravel-archivable.

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Filed in

Sponsored

acquaintsoft logo
Acquaint Softtech

Hire Laravel developers with AI expertise at $20/hr. Get started in 48 hours.

Visit Acquaint Softtech

The latest

View all →
Image Dominant Color and HEIC Support in Laravel 13.24 image

Image Dominant Color and HEIC Support in Laravel 13.24

Read article
Official Laravel Zed Extension: LSP for PHP & Blade image

Official Laravel Zed Extension: LSP for PHP & Blade

Read article
Laravel Head: Manage Meta Tags, Open Graph, and JSON-LD image

Laravel Head: Manage Meta Tags, Open Graph, and JSON-LD

Read article
PhpStorm 2026.2 Released image

PhpStorm 2026.2 Released

Read article
Laravel Doctor: Diagnose Your App With One Artisan Command image

Laravel Doctor: Diagnose Your App With One Artisan Command

Read article
CPX: The Composer Package Executor for PHP image

CPX: The Composer Package Executor for PHP

Read article