Hiding relationManagers on view page (v2)

So i've created a view page and hooked it upto a resource, what i'm wanting to do is not show the related resource managers on this page, but i cant seem to find a way to override getRelations() thats set on the main resource. i've tried including the same method on the view page class but no luck - is there a specific way to do this?
5 Replies
Wbzy
Wbzy16mo ago
also wondering this too, i try to hide it in edit/view
Patrick Boivin
Patrick Boivin16mo ago
I'm not entirely sure but I think the simplest way would be to hide it via CSS
yandos666
yandos666OP16mo ago
@wbzyfishy in the end i did a hack with checking the route name, if it was a view route I passed back an empty array. Not pretty but it worked
public static function getRelations(): array { if (Route::getCurrentRoute() && Route::getCurrentRoute()->getName() === 'filament.resources.events.view') { return []; } return [ StatementsRelationManager::class, AssetsRelationManager::class, ]; }
Patrick Boivin
Patrick Boivin16mo ago
I think this works on the initial page load but can be problematic with subsequent Livewire requests like page actions.
Dennis Koch
Dennis Koch10mo ago
You can overwrite the behvaiour on the ViewPage. There should be a getRelationManagers() or similar method
Want results from more Discord servers?
Add your server