Unfortunately I cannot think of a good example for a resource that would have a relationship with the user.
The official documentation is here https://docs.flarum.org/extend/data.html but it doesn't show a full example of setting up a new relationship from database to frontend.
The groups in core is the best example in itself, but seeing it's not in an extension it's difficult to find all the related code if you don't know what you're looking for.
Tags or Flags can be a good example of a resource that has a relationship with a discussion or post. But there's no written guide, you would need to review the source code.
I have my video series which show most of the concept required to do this, unfortunately I mostly cover custom attributes and not custom relationships https://discuss.flarum.org/d/11756-videos-on-how-to-extend-flarum I could try to make a video about a relationship in one of the coming streams.