mrmardel/filament-approvals
Composer 安装命令:
composer require mrmardel/filament-approvals
包简介
Manage approval processes in your filament application
README 文档
README
This package allows you to implement approval flows in your Laravel Filament application.
This package brings the ringlesoft/laravel-process-approval) functionalities to filament. You can use all the ringlesoft/laravel-process-approval features in your laravel project. It also uses the spatie/laravel-permissions package, so you can use all its features.
🛠️ Be Part of the Journey
Hi, I'm Eighty Nine. I created aprovals plugin to solve real problems I faced as a developer. Your sponsorship will allow me to dedicate more time to enhancing these tools and helping more people. Become a sponsor and join me in making a positive impact on the developer community.
Quick understanding the package
Some processes in your application require to be approved by multiple people before the process can be completed. For example, an employee submits a timesheet, then the supervisor approves, then manager approves and finally the HR approves and the timesheet is logged. This package is a solution for this type of processes.
Approval flow
This is the chain of events for a particular process. For example, timesheet submission, expense request, leave request. These processes require that multiple people have check and approve or reject, until the process is complete.
Approval flows are based on a model, example, ExpenseRequest, LeaveRequest, TimesheetLogSubmission etc
Approval step
These are the steps that the process has. Each step is associated with a role that contains users that need to approve. When any of the users in the role approves, the process moves forward to the next step.
This package is based on roles, which are provided by the package spatie/laravel-permission.
Installation
You can install the package via composer:
composer require eightynine/filament-approvals
Usage
- Run the migrations using:
php artisan migrate
- Add the plugin to your panel service provider as follows:
->plugins([ \EightyNine\Approvals\ApprovalPlugin::make() ])
- Make your model extend the ApprovableModel
namespace App\Models; use EightyNine\Approvals\Models\ApprovableModel; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class LeaveRequest extends ApprovableModel { use HasFactory; protected $fillable = ["name"]; }
- Create approval flows
-
In your dashboard, a "Approval flows menu will have appeared". Click it and start creating the approval flows. The name is the name of the model, that you are using in your flow.
-
After you create your first approval create the steps. The steps will require that you have already create roles in your admin panel using the spatie/laravel-permission package.
-
You can move to the next step 😉
- Add the approvable actions:
- In your resource table, add the approvable actions
$table ->actions( ...\EightyNine\Approvals\Tables\Actions\ApprovalActions::make( // define your action here that will appear once approval is completed Action::make("Done"), [ Tables\Actions\EditAction::make(), Tables\Actions\ViewAction::make() ] ), )
- In your view page or edit page, you can include the approval actions using the trait HasApprovalHeaderActions, and define the method getOnCompletionAction() that will return the action(s) to be shown once complete. If this method is not implemented and you use the trait, an error will be thrown.
namespace App\Filament\Resources\LeaveRequestResource\Pages; use App\Filament\Resources\LeaveRequestResource; use Filament\Actions; use Filament\Actions\Action; use Filament\Resources\Pages\ViewRecord; class ViewLeaveRequest extends ViewRecord { use \EightyNine\Approvals\Traits\HasApprovalHeaderActions; protected static string $resource = LeaveRequestResource::class; /** * Get the completion action. * * @return Filament\Actions\Action * @throws Exception */ protected function getOnCompletionAction(): Action { return Action::make("Done") ->color("success") // Do not use the visible method, since it is being used internally to show this action if the approval flow has been completed. // Using the hidden method add your condition to prevent the action from being performed more than once ->hidden(fn(ApprovableModel $record)=> $record->shouldBeHidden()) } }
- Add the ApprovalStatusColumn to your table to see the status of the approval flow
return $table ->columns([ TextColumn::make("name"), \EightyNine\Approvals\Tables\Columns\ApprovalStatusColumn::make("approvalStatus.status"), ]) ...
Just like that, you are good to go, make some moneyyyyy🤑
To add more approval flows(models), repeat the steps 3-6
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Eighty Nine
- Tony Partridge
- Ringlesoft for the base approval model logic
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
mrmardel/filament-approvals 适用场景与选型建议
mrmardel/filament-approvals 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 04 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「eightynine」 「filament-approvals」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mrmardel/filament-approvals 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mrmardel/filament-approvals 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mrmardel/filament-approvals 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Advanced widgets for your filament php application
Elegant reports in your filament application
Manage approval processes in your filament application
Elegant documentation system for your Filament application with search, navigation, and markdown support
Allow your users to periodically reset their passwords, to enforce security.
Display more intrusive alerts in any filament page
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-06