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.Filed in: News
Join 31,000+ others and never miss out on new tips, tutorials, and more.
- Laravel Senior Developer
Remote, Canada Only
BeMo Academic Consulting
- Senior Fullstack Developer / Architect (w/m/d)
Remote / Munich - Germany
- Medior full stack developer (Laravel)
Deventer (or remote) in the Netherlands, Dutch speaking required.
- Senior Full Stack PHP Developer (Laravel)
- Senior Laravel Developer
Laravel Castable Data Transfer Object
Laravel Castable Data Transfer Object is a package by Jess Archer for casting JSON columns in the database to a value…
Changes coming to PHP Faker
The PHP Faker library is one of those tools that is hugely helpful when developing locally so you can see dummy data,…