Adam Holmes
Prompt input via modal on save
Hi,
I have a status field on a form which is a
ToggleButton
populated by an enum. I would like to add some functionality so that when I save the form, if this field has changed to a specific option then a modal should appear and the user should enter a reason (which is just a text area).
I would like the reason to save into a different database table as the form I'm on because I'd like to save individual rows for each change so that I can report on all the changes later (rather than overwriting the reason each time).
I'm at a real loss of how to make this happen as I'm fairly new to filament.
I managed to make it overwrite the data on the same model but hiding / showing a field, but that's not what I want - I want a modal to popup on save. I also tried to add a relationship to a Group
but that is still a HasOne
where I would like a HasMany
.
Any ideas or pointers in the right direction would be much appreciated.
Thanks7 replies
Testing form with relationships
Hi,
I'm attempting to test a create form for my Users page. The form has basic info on, as well as a roles dropdown which uses filament-shield. When using the UI, everything works fine. When I run the test to make sure there are no errors, the test fails with the following and I can't work out why:
Test
Factory
Roles dropdown in form schema
TIA, Adam
3 replies
editOptionForm with permissions
Hi,
I have a select form component which uses a relationship to look at another model. I use
editOptionForm
to create a modal so that I can edit the selected field. This all works fine.
However, I would like the edit button to only show for certain users (which I'll manage with spatie) - but I'm not sure how to make the button show / hide?
Any ideas?
Thanks3 replies
Option to set default table pagination
Hi,
I'm creating some tables that have plenty data in them. I have pagination enabled with the default options of
[5, 10, 25, 50, 'all']
- I'd like to keep those options, but default the view to 25 rather than 10.
Looking at CanPaginateRecords
I can see the below method, but it seems that we either show 10 rows if it's in the options array, otherwise we just use the first item. I could override the default options and change 10 to 9 or 11, but that doesn't feel right.
Is there a way that I can get round this? Or request it as a feature in a future release?
Cheers
Adam8 replies
Query string in pagination
Hi,
From an edit resource I have a button that links to another list (Audits) resource with 2 parameters like so:
In my audit list resource I then filter all the audits (this is a polymorphic table and stores the model class name and the model id - note that this is using Laravel Auditing - https://laravel-auditing.com/) based on the 2 GET parameters that are passed like so:
Which all works fine on the first load. However, when I change the pagination my request object is reset to null and therefore the above query no longer works.
With Laravel you can do
::paginate()->withQueryString()
but I can't find anything similar with Filament.
Any ideas to ensure that the request object sticks around, or a better solution to this problem that requires no sending of things in the request?
Thanks 🙂8 replies
Unable to add form actions to modal
Hi,
I've got a resource with a simple form for creating / editing. I've got a table that displays all the items on the index. Each row in the table has an edit button that opens the edit page in a modal slideover. At the bottom there is a "Save changes" and "Cancel" button.
I'd like to add an additional button to the bottom, but I'm unable to get it to show.
I added the below to my EditItem.php in the Resource Pages directory and the button didn't show.
I also tried
getModalActions
which made no difference.
If I change the page to be a separate page rather than a modal, the button does appear - but that's not what I want.
I'm at a loss, so any ideas welcome.
Thanks5 replies