Is the group relationship in the User model defined for the groups that they own, or the ones that they are a member of. You could, and probably should, define both.
/* The groups the user owns */
public function groups()
{
return $this->hasMany(Group::class);
}
/*The groups the user is a member of */
/* I couldn't think of a better name */
/* This would be the reverse of the members relationship defined in the Groups model */
public function memberGroups()
{
return $this->belongsToMany(Group::class, 'members');
}
If you have this, then I don't see why your original query wouldn't work. Calling auth()->user()->groups would then lazily retrieve only the groups that the user owns.
You could lazily eager load the groups and members by calling auth()->user()->load('groups.members').