F
Filamentβ€’12mo ago
wazkaz

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:
Okay I found a solution. It was pretty simple, modifying the blade and render depends on a property defined in the relation manager.
Jump to solution
11 Replies
wazkaz
wazkazOPβ€’12mo ago
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.
DrByte
DrByteβ€’12mo ago
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.
wazkaz
wazkazOPβ€’12mo ago
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.
DrByte
DrByteβ€’12mo ago
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
wazkaz
wazkazOPβ€’12mo ago
I thought that too but I hoped there is another solution, which is not changing the source code
DrByte
DrByteβ€’12mo ago
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!
wazkaz
wazkazOPβ€’12mo ago
Thanks for the answers:)
Solution
wazkaz
wazkazβ€’12mo ago
Okay I found a solution. It was pretty simple, modifying the blade and render depends on a property defined in the relation manager.
DrByte
DrByteβ€’12mo ago
Do you mind sharing your code? And where did you put your modified blade file?
Moe Tarhini
Moe Tarhiniβ€’10mo ago
Hey man, do you mind to share your code ? it will be very helpfull
Want results from more Discord servers?
Add your server