Relation manager display
Hey everyone,
I hope you're doing well! I'm currently working with Filament PHP and running into a bit of a challenge with the relation manager. It has two layout options, but by default, it only renders one at a time.
I'm looking for some advice or ideas on how I can make it render both layouts simultaneously. Any tips or experiences you could share would be super helpful!
Thanks in advance! π
Solution:Jump to solution
Okay I found a solution. It was pretty simple, modifying the blade and render depends on a property defined in the relation manager.
11 Replies
Currently Filament allows to render one RelationManager block with tabs or without on a Resource Page, however, what I want to achieve is 2 relation manager blocks one after another. This would mean that after the resource form should come 2 tabbed relation manager blocks, both with it's own tab navigation, idependently from eachother. It's like if I had two getRelations method in one single Resource.
You can combine RelationManagers into RelationManagerGroups: https://filamentphp.com/docs/3.x/panels/resources/relation-managers#grouping-relation-managers
But I think what you get then is a tab for each group, and inside each group are each of the managers stacked one after the other.
Yes but it only just render the single relation manager or just the group at the same time and I would like to render both at the same time.
I think you might have to override (create your own inspired from the default) page component. This is the EditRecord component: https://github.com/filamentphp/filament/blob/3.x/packages/panels/resources/views/resources/pages/edit-record.blade.php You can see where it only calls the one set of relation managers, preferring to group the grouped ones into tabs. But then within the group to display them stacked.
GitHub
filament/packages/panels/resources/views/resources/pages/edit-recor...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
I thought that too but I hoped there is another solution, which is not changing the source code
Well there's also the potential of submitting a PR to make that feature available. I can't guarantee its acceptance, but if the use-case is clearly explained and the code changes don't make it super hard to maintain, then the chances are better!
Thanks for the answers:)
Solution
Okay I found a solution. It was pretty simple, modifying the blade and render depends on a property defined in the relation manager.
Do you mind sharing your code?
And where did you put your modified blade file?
Hey man, do you mind to share your code ? it will be very helpfull