Sesh
How to stop an action on certain conditions with ->before()
What is the best practice in Filament to stop an action from continuing before it runs into a exception? For example I want to show a message to the user if delete is not possible because the category is used for items:
How can I break out of the DeleteAction in this case? Or is there another way to catch en exception and show a notification?
5 replies
Change a table filter from an updated lifecycle hook
I need to change table filter of a V3 standalone table component from a livewire updated lifecycle hook. Basically my questions is: How can I change and apply the table filter from the updated() function outside of the table function.
3 replies
How to search in multiple fields in v3 SelectFilter?
I am using the following relationship select filter:
When I enter a search query in the select filter it should not only find results with a match on "name_en" but also on "shortname_en".
What I tried:
- Add an array of searchable columns to ->searchable(['name_en','shortname_en']) as it would work in the form select => Did not work
- Use a virtual column => Did not work properly because there is not always a value in shortname_en (its nullable) so the virtual is empty in this case
- Using a custom attribute on the model => Didn't work as Filters are doing a direct sql query
Anybody has an idea how to make the Filter search also search in "shortname_en"?
3 replies
Delete action in table builder V3 seems to ignore Policy
I set up a Edit and a Delete action in the V3 table builder. Both policies work correctly when I check them in tinker (so the policy is correctly registered) but in the table builder action the delete action does delete the record and ignores the policy. Am I am missing something? Or is the standalone table builder not behaving the same as the panel: https://filamentphp.com/docs/3.x/panels/resources/deleting-records#authorization in observing model policies?
3 replies
Select filter grouping options in relation filter
I am struggling to get a Select filter on a relation working with option groups described here: https://filamentphp.com/docs/3.x/forms/fields/select#grouping-options
This is my Select field in the table filters:
The format of the options is right and they get displayed correctly with the groups, butwhen i select an entry, I get this error:
How can I configure the select so its checking the relation. When I use ->relation() it takes the options from the relation and not from the customized option array. Thanks.
9 replies
How to use deep relations in filters in the V3 Table Builder?
Is there a way to use deep relations in filters in V3? I have the following relation:
News => belongsToMany => players => belongsTo => playerCategory
Which is defined in the News Model like this (and works):
I want to add a Filter for playerCategories in the News table builder component. I tried this:
And got this error:
Does anyone know how to achieve this? Thanks 🙏
5 replies
Arranging records into a grid does not work
I just tried to arrange my table content into a grid as described here: https://filamentphp.com/docs/3.x/tables/layout#arranging-records-into-a-grid. But it does not work (content is still in the table form). Am I missing something or is the functionality not yet implemented in v3?
Here is my code:
8 replies
Show table in grid
How can I show a table in a grid in V3? In V2 it was possible with like this: https://filamentphp.com/docs/2.x/tables/layout#arranging-records-into-a-grid
I did not find it in the documentation for v3.
7 replies
Certain font sizes (e.g. xs, xl) do not work in Table Builder
I would like to use the tailwind font sizes "xs" and "xl" in the table builder for a TextColumn e.g. like this:
"sm" and "lg" works fine. What am I doing wrong? They are used elsewhere in the app so they should be part of the css.
5 replies
How to force users to re-login when accessing Filament (used as backend)?
I am using Filament as a backend for admins on an app with a TALL frontend (with Laravel Auth Login for the clients). The Filament login backend is also proteced by two-factor (through the filament 2FA plugin). There is just one user model and admins also have access to the frontend where they can login without 2FA (I do not want to force clients to use 2FA). At the moment an admin can circumvent 2FA by logging into the frontend and then accessing the Filament backend. I want users accessing the backend to be forced to login with 2FA through the Filament login flow. How can I achieve that?
2 replies