zimplerapps/filament-archivable
Composer 安装命令:
composer require zimplerapps/filament-archivable
包简介
A filament plugin to use archivable models
关键字:
README 文档
README
Credits & Attribution: This package is a fork of okeonline/filament-archivable. All credits for the original implementation go to the original authors. This fork is maintained by ZimplerApps to support PHP 8.4 and Laravel 12.x.
Filament plugin for archiving and unarchiving table records (eloquent models) based on the Laravel Archivable package by Joe Butcher.
This filament plugin adds an ArchiveAction, an UnArchiveAction and a ArchivedFilter to your resource tables. It's also possible to 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.4
- Laravel ^12.0
- Filament ^3.2
- Laravel Archivable ^1.4 (installed with this plugin)
Installation
You can install the package via composer:
composer require zimplerapps/filament-archivable
Then, add the plugin to the `AppPanelProvider`:
class AppPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
// ...
->plugin(\Zimplerapps\FilamentArchivable\FilamentArchivablePlugin::make());
}
}
This filament plugin automatically installs the Laravel Archivable package by Joe Butcher.
Follow his installation instructions, which -in short- instructs:
1) Add a `archived_atcolumn to your table
2) Use theArchivable`-trait on your model
Usage
Archive and UnArchive table actions
As soon as the `Archivable`-trait from the Laravel Archivable package is added to the model, it is possible to add the following actions to the corresponding resource table:
use Okeonline\FilamentArchivable\Tables\Actions\ArchiveAction;
use Okeonline\FilamentArchivable\Tables\Actions\UnArchiveAction;
// ...
class UserResource extends Resource
{
// ...
public static function table(Table $table): Table
{
return $table
// ...
->actions([
ArchiveAction::make(),
UnArchiveAction::make(),
]);
}
}
It will show the `ArchiveActionon records that aren't archived, and will show theUnArchiveAction` 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.
ArchiveAction::make()
->hiddenLabel()
->tooltip('Archive'),
The table actions call the `$model->archive() and$model->unArchive()` methods that are provided by the Laravel Achivable package.
Archive and UnArchive page actions
As soon as the `Archivable`-trait from the Laravel Archivable package is added to the model, it is possible to add the following actions to the resource pages:
// in e.g. Filament/PostResource/EditPage.php
use Okeonline\FilamentArchivable\Actions\ArchiveAction;
use Okeonline\FilamentArchivable\Actions\UnArchiveAction;
// ...
protected function getHeaderActions(): array
{
return [
ArchiveAction::make(),
UnArchiveAction::make(),
];
}
It will show the `ArchiveActionon records that aren't archived, and will show theUnArchiveAction` 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.
use Filament\Support\Enums\ActionSize;
ArchiveAction::make()
->color('success')
->size(ActionSize::Large),
Filtering
It is also possible to add a `ArchivedFilter` 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
`archived_at IS NULL`
You can add the filter by adding `ArchivedFilter` to your array of resource table filters:
use Okeonline\FilamentArchivable\Tables\Filters\ArchivedFilter;
public static function table(Table $table): Table
{
return $table
// ...
->filters([
ArchivedFilter::make(),
]);
}

The `ArchivedFilter` 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 `ArchivedScope::classon your resource getEloquentQuery()` method:
// in your resource:
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use LaravelArchivable\Scopes\ArchivableScope;
public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()
->withoutGlobalScopes([
SoftDeletingScope::class, // only if soft deleting is also active, otherwise it can be ommitted
ArchivableScope::class,
]);
}
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 `Table::macro` which allows you to add custom (CSS/Tailwind) classes to *table-rows that are archived*:
Just add the method `->archivedRecordClasses()` to your table with archived results.
public static function table(Table $table): Table
{
return $table
->archivedRecordClasses(['opacity-25']);
}

Supported languages
- en - English
- fr - French
- de - German
- nl - Dutch
You can publish and change the language files by running:
php artisan vendor:publish --tag=filament-archivable-translations
Testing
Minimal dev-requirement:
- filament/tables ^3.2.57
composer test
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
License
The MIT License (MIT). Please see License File for more information.
zimplerapps/filament-archivable 适用场景与选型建议
zimplerapps/filament-archivable 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 05 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「eloquent」 「laravel-eloquent」 「filament」 「filamentphp」 「filament-plugins」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 zimplerapps/filament-archivable 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 zimplerapps/filament-archivable 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 zimplerapps/filament-archivable 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Contains useful extensions and mixins for Eloquent.
Laravel package for caching Eloquent model queries
A way to truly decouple eloquent models.
A Laravel Eloquent model trait for translatable resource
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
A filament plugin to use archivable models
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-07