DEV Community

Juan Carlos Padillo
Juan Carlos Padillo

Posted on

Building Teams in Laravel (Ownership & Membership)

After setting up the basic structure of my project, I implemented the team creation flow.

The idea is simple: a registered user can create a team and immediately become both the owner and a member of that team.

Key decision

I separated:

  • ownership → stored in teams.owner_id
  • membership → stored in team_user pivot table

This allows flexibility where:

  • a user can belong to multiple teams
  • roles can be managed per team

How it works

When registered user create a team:

  • A new team is stored with owner_id
  • The user is attached to team_user with role = owner

This ensures the creator is automatically part of the team.

Why this matters

Instead of treating the owner separately, I treat them as a member with elevated permissions

This keeps relationships consistent and simplifies access control later.

Next, I’ll implement the invitation system so team owners can invite other users and build actual collaboration.

Github repo: https://github.com/pads-only/team-task-manager

Top comments (0)