inertia start
Features

Teams

Enable shared teams and manage ownership, members, and invitations.

Teams provide optional ownership, membership, roles, and invitations for shared application resources. A user can create or join multiple teams. Your application supplies the business resources, such as projects or documents, and decides what members can do with them.

Personal account settings and billing belong to the user account. Creating an account works independently of Teams. Team membership does not share a subscription or add seat billing.

Enable Teams

Set these values in your application's .env:

.env
I_S_ENABLE_ACCOUNTS=true
I_S_ENABLE_TEAMS=true

I_S_ENABLE_TEAMS defaults to false. Apply the change through your normal configuration reload. If you cache configuration, rebuild it with php artisan config:cache and reload any long-running application processes.

Open Teams in the account menu or account settings to create a team or open one you already belong to. There is no global team switcher or globally selected team. Each team page identifies the team in its URL, so different browser tabs can work with different teams.

To disable Teams, set I_S_ENABLE_TEAMS=false and reload configuration. The menu and team routes become unavailable. Existing teams, memberships, and invitations stay in the database. Invitations continue to expire on their original schedule. Re-enable the flag to restore access according to the existing memberships.

Guard your own team resource routes with feature:teams too. Disabling the feature must preserve each resource's team_id; it must never convert shared records into personal records, remove an ownership filter, or make records public. Personal account features continue to work independently.

Team roles

RoleWhat the user can do
OwnerRename or delete the team, invite members or admins, change or remove collaborators, and transfer ownership.
AdminRename the team, invite members, and cancel member invitations.
MemberView the team and its members, and leave the team.

Each team has exactly one owner, initially the person who created it. An owner can transfer ownership to an existing collaborator. The previous owner becomes a team admin and can then leave. Team owners must transfer ownership or delete their teams before deleting their account, including while Teams is disabled.

Platform roles control access to the application back office. Team policies use the owner or the user's membership in the specific team. Application-wide roles and permissions use Spatie Permission with its team permission mode disabled. Global permissions do not override resource policies; check membership before adding any permission conditions inside a resource policy.

Invite someone

From the team page, choose Invite member, enter the recipient's email address, and select a role in the dialog. Inertia Start sends an email with a signed link that expires after seven days. The recipient signs in or registers with that address, verifies it, and accepts the invitation. Acceptance creates the membership and consumes the invitation in one transaction.

The team page lists active invitations for owners and admins. Owners can cancel invitations for either role. Admins can cancel invitations for the member role.

Routes and data model

AreaWhere to look
Web team pages/teams and /teams/{team}
Shared team operationsroutes/teams.php
Team authorizationapp/Policies/TeamPolicy.php
Team ownershipteams.owner_id
Collaborator rolesteam_members.role, with one row per team and user
Pending invitationsteam_invitations, with the recipient address, role, and expiration

Teams are identified by a stable ID. The routes scope member and invitation records to their parent team. When you add a team-owned resource, use the team from the route and scope its records and authorization to that team.

Add team-owned resources

Team context is explicit. For example, /teams/42/projects can list team 42's projects, while a project policy checks membership using the project's stored team_id. Visiting another team never changes the authorization context of an existing record.

The following is an application example, not a model shipped by the starter kit. It allows all team members to view projects and only owners/admins to update them. Define abilities to suit your own product.

Store ownership and define relationships

Add the foreign key in your project's migration:

$table->foreignId('team_id')->constrained()->cascadeOnDelete();

This example deletes projects when their team is deleted. Choose retention deliberately for your application and explain that behavior in its deletion UI. Turning the Teams feature off does not delete teams or projects.

Add the relationship to your Project model:

use App\Models\Team;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

/** @return BelongsTo<Team, $this> */
public function team(): BelongsTo
{
    return $this->belongsTo(Team::class);
}

Add the inverse relationship to Team:

use App\Models\Project;
use Illuminate\Database\Eloquent\Relations\HasMany;

/** @return HasMany<Project, $this> */
public function projects(): HasMany
{
    return $this->hasMany(Project::class);
}

Authorize the stored team

Create a ProjectPolicy using Laravel's normal policy convention. Platform admin access does not replace membership in the resource's team.

namespace App\Policies;

use App\Enums\TeamRole;
use App\Models\Project;
use App\Models\User;
use Illuminate\Auth\Access\Response;

class ProjectPolicy
{
    public function view(User $user, Project $project): Response
    {
        return $project->team->roleFor($user) !== null
            ? Response::allow()
            : Response::denyAsNotFound();
    }

    public function update(User $user, Project $project): Response
    {
        $role = $project->team->roleFor($user);
        if ($role === null) {
            return Response::denyAsNotFound();
        }

        return in_array($role, [TeamRole::Owner, TeamRole::Admin], true)
            ? Response::allow()
            : Response::deny();
    }
}

Scope routes and writes

Use scoped bindings so a project from team B cannot be requested under team A's URL. Keep the policy check: a valid parent-child relationship alone does not authorize the current user.

use App\Models\Project;
use App\Models\Team;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Route;

Route::middleware(['auth', 'verified', 'feature:teams'])
    ->scopeBindings()
    ->group(function (): void {
        Route::get('/teams/{team}/projects/{project}', function (Team $team, Project $project): JsonResponse {
            Gate::authorize('view', $project);

            return response()->json(['id' => $project->id, 'name' => $project->name]);
        })->name('teams.projects.show');

        Route::patch('/teams/{team}/projects/{project}', function (Request $request, Team $team, Project $project): JsonResponse {
            Gate::authorize('update', $project);
            $project->update($request->validate(['name' => ['required', 'string', 'max:255']]));

            return response()->json(['id' => $project->id, 'name' => $project->name]);
        })->name('teams.projects.update');
    });

These JSON responses illustrate the authorization boundary. Use your application's Inertia pages or API resources for its actual interface.

When creating a record, authorize the team and create through its relationship with validated attributes:

Gate::authorize('update', $team);
$project = $team->projects()->create(
    $request->validate(['name' => ['required', 'string', 'max:255']]),
);

Allow name for mass assignment in the Project model. Ownership comes from the authorized relationship, not a submitted team_id. Moving a record between teams should be a separate, explicitly authorized operation.

For a non-nested URL such as /projects/{project}, keep feature:teams on the route and authorize $project through its policy in the same way. No session or user-level current-team setting is needed.

Verify the integration

Cover members reading, owners/admins updating, non-members receiving 404, insufficient roles receiving 403, cross-team child IDs receiving 404, and access ending after membership removal. Verify that disabling Teams blocks the resource routes without changing ownership, then that re-enabling restores the same access. The starter's tests/Feature/TeamOwnedResourcesTest.php exercises this pattern with isolated test-owned resource fixtures.

On this page