Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ksmit799's avatar

Users and Groups with Eloquent/Nova

Hey all, I'm trying to implement a groups feature in my Laravel website, using Eloquent and Nova as a backend. I have three tables, a generic users table (builtin Laravel one), a groups table, and a user_groups table as a pivot table.

The groups table looks like this:

id bigInt PK
owner_id bigInt FK(users.id)
name text
description text

and the user groups table looks like this:

group_id bigInt FK(groups.id)
user_id bigInt FK(users.id)

This is a many-to-many relationship with regards to the members of a group, however I'm wondering the best way to automatically assign the owner of a group as a member. If I manually create a new group in Nova and specify an owner, that owner isn't technically apart of that group unless I also manually create a record in the user_groups pivot table. Is there a way to automate this so Nova just handles it? or should I consider refactoring the database design itself.

Thanks for the help.

0 likes
0 replies

Please or to participate in this conversation.