Kaesa Lyrih
Where to Inject a Custom Action in Filament EditPage After Policy and Validation Are Passed?
Hi everyone! 👋
I'm currently building a custom
UpdateUserAction
and would like to integrate it properly into a Filament EditRecord
page.
---
✅ My Goal:
I want to run a custom action (e.g., UpdateUserAction
) only after:
1. Policy Authorization has passed (can:update
on the model)
2. Validation has been successfully performed using the form schema
3. Data has been potentially transformed (if needed)
---
🤔 My Main Question:
Which method inside the EditRecord
or EditUser
page is best for injecting a custom action after authorization and validation have passed?
I want to avoid doing policy or validation inside the action itself — my goal is to delegate those responsibilities to Filament’s internal authorization and validation flow, and only call the action after that.
For example:
Is handleRecordUpdate()
guaranteed to run only after policy and validation have passed?
If not, is there a more appropriate method to override?
---
🛠️ Context:
I want to avoid calling FormRequest
manually inside this method — I'd rather lean on Filament’s built-in validation and authorization mechanisms that already wrap around the EditPage lifecycle.
---
🙏 What I'm Looking For:
* Confirmation that handleRecordUpdate()
is the right place to inject my custom action.
* If not, what would be the best method/hook to override?
* Any example of delegating business logic into an action after Filament’s validation/policy pipeline.
Thanks in advance for your help! I’d love to make this pattern as clean and idiomatic as possible with Filament. 🔧3 replies
How to modify "Create Another" action in Filament to include a query parameter based on a form field
Question:
I'm using FilamentPHP and I want to enhance the "Create Another" behavior when creating a resource (e.g.,
Product
). Specifically, I'd like to redirect to the create page again, but with a query parameter (e.g., ?store_id=123
) taken from the currently submitted form field (store_id
).
My goal is to make it easier for users who are adding multiple products to the same store consecutively.
How can I modify the "Create Another" functionality in a custom CreateRecord
page (like CreateProduct
) to append this query parameter after saving?
Any best practices or recommended approach?
Use Case Example:
* User selects a store (store_id = 5
) while creating a product.
* After saving and clicking "Create Another", the user is redirected to /admin/products/create?store_id=5
, so the store_id
field is pre-filled for the next product.
Thanks in advance!3 replies
Can Query Model Pivot Custom Table without field id?
I'm trying to create a Custom Table with the Pivot Model
Enrollment
, but I encountered an error. I don't have the id
field in the enrollments
pivot table. How can I modify the query without using ORDER BY id
? Should I add the id field to the pivot table?
- Error:
SQLSTATE[42703]: Undefined column: 7 ERROR: column enrollments.id does not exist LINE 1: select * from "enrollments" order by "enrollments"."id" asc ... ^
5 replies
Summarize Table RelationManager
I am attempting to use the
summarize
feature from Filament on a table that exists in RelationManager
. However, I encounter an error:
When I remove $table->id()
in create_package_product_table.php
, the error changes to:
If I remove $table->timestamps()
in create_package_product_table.php
, the summarize feature can be used. How can I use summarize
on a table in RelationManager
without having to remove $table->id()
and $table->timestamps()
?5 replies