How to dynamically set getRelations()?

Hi all. For a user resource view page we have multiple relations set through the RelationManagers. However, dependent on the current type of user (admin, customer etc.) we are looking at displaying different relationships as some will always be empty for specific types of users. The type of user is an attribute on our User model. Is there any way to set these relations dynamically in getRelations() to prevent redundant tabs from showing? Thanks in advance!
3 Replies
Dan Harrin
Dan Harrin2y ago
you can define getRelationManagers() on the page instead and return different ones based on $this->record there is also canViewForRecord() on the relation manager class, you can use that instead to conditionally hide a relation manager based on the type of user
TiBiBa
TiBiBaOP2y ago
Thank you very much!
gizmojo
gizmojo10mo ago
Hats off to you Dan! I've lost count of the number of times you've already planned the feature I end up needing.
Want results from more Discord servers?
Add your server