nowak
How to add a CreateAction in the headerActions of resource A, to create a record in resource B?
After looking into this again, I thought that it was weird that the native CreateAction didn't work. So I tried to add this to the List page instead:
Which works, but I have to add
mutateFormDataUsing
and after
logic, as this is not inherited from the UserOrderResource Create page.
So this action would be added to the page header instead of the table header, which is also a con, but CreateAction() just doesn't work from a tables headerActions([]) for some good reason probably.
@ChesterS Maybe useful for you as well?23 replies
Sort table by random order
Okay, I got curious so I added a 2000 song table to a fresh filament installation and did some experimenting. got it to work by using baseQuery instead of query (https://filamentphp.com/docs/3.x/tables/filters/getting-started#modifying-the-base-query) :
15 replies
Sort table by random order
Are you showing thousands of songs at once? You could just shuffle the songs shown in the current view. I don't know how expensive it would be to shuffle all songs in the database, might be worth trying out, though
15 replies
I get Class "App\Filament\Pages\Dashboard" not found after removing Dashboard on Production
I removed KitchenDashboard from my admin panel provider pages as this wasn't necessary on a fresh filament installation, and changed to:
I get the same ish error still:
Here is my flare error:
https://flareapp.io/share/bP9oYg85
25 replies
Sort table by random order
I think what you need to do, is to add a sorting column to your songs table, that you can use to:
1. Sort the records by in the table
2. Use a custom table header action to "randomly" shuffle the sort integers of your song records
Then when you trigger your "Randomize" action, the sort would be shuffled, and your song records would appear to be shuffled as well as a result.
15 replies
I get Class "App\Filament\Pages\Dashboard" not found after removing Dashboard on Production
I just tried to add to add my new dashboard to ->pages() like this:
And I still get the error:
Class "App\Filament\Pages\Dashboard" not found
But I just don't understand where filament gets App\Filament\Pages\Dashboard
from, as I don't have that in my code anywhere 🤔
Here is a shared flare of my error, it seems to have something to do with routes:
https://flareapp.io/share/LPd0G9dP25 replies
How to add a CreateAction in the headerActions of resource A, to create a record in resource B?
The detail relationship is on the UserOrder model though:
My approach is that I have a GroupOrderResource, where I manage all GroupOrders (add couriers, set routes etc.) directly on the table. All UserOrders belong to a GroupOrder, and what I want to do, is add an action on this table, where I can easily create a new UserOrder. I know I could edit a GroupOrder -> UserOrder relations -> Create. But that is a few clicks and loading away, and if a GroupOrder does not exist yet, I can't use this approach (a GroupOrder is created after an initial UserOrder is created). So having an action to create a UserOrder directly on the GroupOrderResource would be very helpful.
23 replies
How to add a CreateAction in the headerActions of resource A, to create a record in resource B?
I am only using resources. Where this header action on the GroupOrderResource:
Gives me this error:
Because my Form Schema in UserOrderResource has this form component:
Which is strange, as I pass the
->model(UserOrder::class)
23 replies