Relationship manager doesn't show up on edit page

I have created a relationship manager, for a HasMany relationship, with the command from the docs and added it to the resource. However the table that should be on the edit page doesn't show up. This is especially weird, because we already have relationship managers for different hasMany relationships, that work without issues. There are no errors coming from the backend nor in the browser console. I have tested the model relationship both ways and they work. When I dump inside the models relationship function, I can see that it's being called, but no queries related to the table are run. I can also see that by the code throwing an error if I change $relationship to a non-existing function. The table function in the relationship manager is not being called at any point. I have tried reinstalling and updating all dependencies. Sorry if there's something obvious I have missed, but I'm at my wits' end.
Solution:
Do you happen to have Policy blocking access to the RelationManager?
Jump to solution
4 Replies
JJSanders
JJSanders2mo ago
Did you add the relation to your resource?
public static function getRelations(): array
{
return [
RelationManagers\PostsRelationManager::class,
];
}
public static function getRelations(): array
{
return [
RelationManagers\PostsRelationManager::class,
];
}
Oliverdam
Oliverdam2mo ago
Yes
Solution
jonquihote
jonquihote2mo ago
Do you happen to have Policy blocking access to the RelationManager?
Oliverdam
Oliverdam2mo ago
Thanks, that's what was blocking it. I don't know why it's blocking it though, since I have a role that's bypassing all the policies and that works for everything except this one instance. But thanks for pointing me in the right direction.