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
also wondering this too, i try to hide it in edit/view
I'm not entirely sure but I think the simplest way would be to hide it via CSS
@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,
];
}
I think this works on the initial page load but can be problematic with subsequent Livewire requests like page actions.
You can overwrite the behvaiour on the ViewPage. There should be a
getRelationManagers()
or similar method