Multiple filament (?) components in a single page
Hello, I'm looking for some design advice.
I would like to have a creation form, which would turn into an editing form on submit, would spawn a relation manager after running a job to generate the related models, and could open an infolist to show the details of a row, all on the same page.
Do you think Filament is equipped to deal with that kind of request, which does stray a fair bit from "admin panel", or otherwise what kind of tool am I looking for to make that kind of front-end?
I think Filament could do it (since all the bits I mentioned do exist in Filament), but I don't know what I need to design that could hold all those things going on at once. Is it a livewire component? Would I need to manually implement specific traits from the Filament contracts to make it work? Is this a different pattern from Active Record? I just really don't know..
Solution:Jump to solution
I have since worked on other parts of the app while refining the model and went with a classic resource-page based design, I tackled making a custom page again and was eventually able to fit form, table and infolist in a single page by implementing the relevant interfaces (
HasForms
, HasTable
, HasInfolists
) and using the relevant traits (InteractswithForms
, InteractswithTables
and InteractswithInfolists
).
The biggest thing that eventually made it click for me is that I didn't need to edit the record after creation at all, so just having a form create the record and customizing the creation process so that the created record is stored to a property on the Page and sent to the Table to get the related records was enough. Using the @if
directive to conditionally show the selected record on the table fixed the Infolist throwing an error about a record not being set that was stumping me.
Filament really is a wonderful framework and I hope to learn even more about it to make even more functional components and better apps....6 Replies
Have you tried the demo? This shows a coule of pages (orders) which does what you are looking for (I think) https://demo.filamentphp.com
I checked it out, I don't think the orders page is doing what I need.. am I looking for something outlandish after all?
what you are looking for seems to be pretty basic filament to be honest...
have you tried setting a simple page first?
1. create page
2. edit page -> with relationmanager (table) to display related data
3. the relationmanager can have buttons which opens a modal for more info
Outlandish ?
What you are wanting is filament 101 straigt out the box, minimal work stuff.
So you can create a custome page that has forms and tables and infolist in same blade file
Then by
@if
conditions you show and hide wanted pieces. Like if the record exists them show the edit form else show the create form (you can use one form and feed it the record). Same for infolistSolution
I have since worked on other parts of the app while refining the model and went with a classic resource-page based design, I tackled making a custom page again and was eventually able to fit form, table and infolist in a single page by implementing the relevant interfaces (
HasForms
, HasTable
, HasInfolists
) and using the relevant traits (InteractswithForms
, InteractswithTables
and InteractswithInfolists
).
The biggest thing that eventually made it click for me is that I didn't need to edit the record after creation at all, so just having a form create the record and customizing the creation process so that the created record is stored to a property on the Page and sent to the Table to get the related records was enough. Using the @if
directive to conditionally show the selected record on the table fixed the Infolist throwing an error about a record not being set that was stumping me.
Filament really is a wonderful framework and I hope to learn even more about it to make even more functional components and better apps.
Thanks @Amiejah and @Hasan Tahseen for the guidance