Download the PHP package okeonline/filament-archivable without Composer
On this page you can find all versions of the php package okeonline/filament-archivable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download okeonline/filament-archivable
More information about okeonline/filament-archivable
Files in okeonline/filament-archivable
Package filament-archivable
Short Description A filament plugin to use archivable models
License MIT
Homepage https://github.com/okeonline/filament-archivable
Informations about the package filament-archivable
Filament plugin to archive, unarchive and filter records
Filament plugin for archiving and unarchiving table records (eloquent models) based on the Laravel Archivable package by Joe Butcher.
This filament plugin adds an add custom row-classes for archived records. In addition to table-actions, the package provides also page-actions for view/edit pages to archive and unarchive your records.
Requirements
- PHP ^8.3
- Laravel ^11.0
- Filament ^3.0
- Laravel Archivable ^1.4 (installed with this plugin)
Installation
You can install the package via composer:
Then, add the plugin to the :
This filament plugin automatically installs the Laravel Archivable package by Joe Butcher.
Follow his installation instructions, which -in short- instructs:
1) Add a column to your table 2) Use the -trait on your model
Usage
Archive and UnArchive table actions
As soon as the -trait from the Laravel Archivable package is added to the model, it is possible to add the following actions to the corresponding resource table:
It will show the on records that aren't archived, and will show the on those which are currently archived:
You should add both actions to the same table. The action itself wil determine if it should be shown on the record.
The actions are normal table actions, similar to the Delete and Restore table actions of FilamentPHP. You can add all features that are described in the FilamentPHP Table Actions Documentation, like:
- ... etc.
The table actions call the and methods that are provided by the Laravel Achivable package.
Archive and UnArchive page actions
As soon as the -trait from the Laravel Archivable package is added to the model, it is possible to add the following actions to the resource pages:
It will show the on records that aren't archived, and will show the on those which are currently archived:
Be aware that there is a difference between table actions and normal (page) actions. You can not use the page actions as a table action, vice versa. Nevertheless, the business-logic is the same. Read this page for more information about the difference.
You should add both actions to the same page. The action itself wil determine if it should be shown on the record. Check this if you want to edit (and unarchive) records that are being archived.
The actions are normal actions, similar to the Delete and Restore actions of FilamentPHP. You can add all features that are described in the FilamentPHP Actions Documentation, like:
- ... etc.
Filtering
It is also possible to add a to the resoucre table, which adds three filtering options:
- Show only unarchived records
- Show only archived records
- Show both
By default, an unfiltered table will only show the unarchived records, as the Laravel Archivable package comes with a default global scope to query records with
You can add the filter by adding to your array of resource table filters:
The will respect all options that Tenary Filters have, so check the Tenary Filter Documentation of Filament to customize the filter.
Ability to view/edit/delete archived records
If you want to be able to view/edit/delete archived records, you should disable the global on your resource method:
See Disabeling global scopes on Filament for more information about the default resource query.
Add custom classes to archived rows
This plugin comes with a which allows you to add custom (CSS/Tailwind) classes to table-rows that are archived:
Just add the method to your table with archived results.
Supported languages
- en - English
- fr - French
- de - German
- nl - Dutch
You can publish and change the language files by running:
Testing
Minimal dev-requirement:
- filament/tables ^3.2.57
Changelog
Please see CHANGELOG for more information on what has changed recently.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Rudi van Zandwijk
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of filament-archivable with dependencies
filament/filament Version ^3.2
illuminate/support Version ^11.0
illuminate/database Version ^11.0
illuminate/contracts Version ^10.0||^11.0
joelbutcher/laravel-archivable Version ^1.4
spatie/laravel-package-tools Version ^1.16