Download the PHP package xplodman/filamentapproval without Composer
On this page you can find all versions of the php package xplodman/filamentapproval. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download xplodman/filamentapproval
More information about xplodman/filamentapproval
Files in xplodman/filamentapproval
Package filamentapproval
Short Description A Filament plugin for approval / moderation of create/edit/delete operations.
License MIT
Homepage https://github.com/xplodman/filamentapproval
Informations about the package filamentapproval
FilamentApproval
A powerful Filament plugin that adds approval workflows to your create, edit, and delete operations. Perfect for content moderation, administrative oversight, and maintaining data integrity in your Filament applications.
โจ Features
- ๐ Complete CRUD Approval - Intercept create, edit, and delete operations
- ๐ฏ Easy Integration - Simple traits to add to your existing Filament resources
- ๐ฅ User-Friendly - Clear notifications and intuitive approval interface
- ๐ Permission-Based - Configurable bypass permissions for administrators
- ๐ Rich Management - Comprehensive approval request management interface
- ๐จ Filament Native - Built specifically for Filament v4 with modern UI components
- ๐ Detailed Tracking - Track changes, original data, and approval history
- โก Performance Optimized - Efficient database queries and indexing
๐ Installation
You can install the package via Composer:
Publish Configuration and Migrations
Publish the configuration file:
Publish and run the migrations:
Register the Plugin
Add the plugin to your Filament panel provider:
โ๏ธ Configuration
The package comes with a comprehensive configuration file at config/filamentapproval.php:
๐ Usage
1. Create Operations
Add the InterceptsCreateForApproval trait to your create page:
2. Edit Operations
Add the InterceptsEditForApproval trait to your edit page:
3. Resource Configuration
Update your resource to use the approval-enabled pages:
4. Relationship Handling
If your model has relationships that need to be handled during approval, define the approvalRelations() method in your resource. This method tells the package how to handle different relationship types during the approval process.
Available Relation Types
The package supports the following relationship types via RelationTypeEnum:
BELONGS_TO- One-to-one and many-to-one relationshipsBELONGS_TO_MANY- Many-to-many relationshipsMORPH_TO_MANY- Polymorphic many-to-many relationshipsHAS_MANY- One-to-many relationshipsMORPH_MANY- Polymorphic one-to-many relationships
Example Usage
5. Approval Request Resource
By default, the approval request resource is not automatically registered. You have two options:
Option 1: Enable Auto Registration
Set auto_register_resource to true in your config:
Option 2: Manual Registration (Recommended)
Keep auto_register_resource as false and manually register the resource in your panel:
6. Permissions Setup
With Filament Shield
If using Filament Shield, add these permissions to your custom_permissions:
Then update your config:
With Spatie Permission
๐๏ธ Database Schema
The package creates an approval_requests table with the following structure:
| Column | Type | Description |
|---|---|---|
id |
ULID | Primary key |
request_type |
String | Type of request (create, edit, delete) |
requester_id |
BigInt | ID of the user who made the request |
approvable_type |
String | The model class being approved |
approvable_id |
ULID | ID of the specific model instance |
attributes |
JSON | Model attributes data |
relationships |
JSON | Relationship data (for future use) |
original_data |
JSON | Original values (for edit requests) |
resource_class |
String | Filament resource class for form rendering |
status |
String | Current status (pending, approved, rejected) |
decided_by_id |
BigInt | ID of the user who made the decision |
decided_reason |
Text | Optional reason for the decision |
decided_at |
Timestamp | When the decision was made |
created_at, updated_at, deleted_at |
Timestamps | Standard Laravel timestamps |
๐ How It Works
Create Flow
- User submits a create form
- Form data is captured and stored in
approval_requeststable - Actual record creation is prevented
- User receives notification that request is pending approval
- Administrator reviews and approves/rejects the request
- If approved, the actual model is created with the captured data
Edit Flow
- User modifies a record and saves
- Changes are detected and compared with original data
- An approval request is created with the proposed changes
- Original record remains unchanged
- Administrator reviews the changes
- If approved, changes are applied to the original record
Delete Flow
- User attempts to delete a record
- Delete action is intercepted
- An approval request is created for the deletion
- Record remains in the database
- Administrator reviews the deletion request
- If approved, the record is actually deleted
๐จ User Experience
- Clear Notifications: Users receive immediate feedback when requests are submitted
- Intuitive Interface: Approval requests are managed through a familiar Filament resource
- Change Tracking: Administrators can see exactly what changes were proposed
- Permission-Based: Users with bypass permissions can skip approval workflows
- Responsive Design: Works seamlessly across all device sizes
๐งช Testing
Run the test suite:
๐ 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.
๐ License
The MIT License (MIT). Please see License File for more information.
๐ Credits
- Xplodman
- All Contributors
Made with โค๏ธ for the Filament community
All versions of filamentapproval with dependencies
filament/filament Version ^4.0
spatie/laravel-package-tools Version ^1.15.0