Laravel 13 adds native team support to official starter kits
Multi-tenancy arrives for Laravel starter kits
Prerequisites and installation
To use this feature, you must use the
- Livewire: You must choose the Livewirestarter kit.
- Class Components: You must select No when asked if you want single-file functional components; the team's logic currently relies on standard Livewireclass components.
laravel new my-team-app
# Select Livewire -> Class Components -> Yes to Team Support
Database architecture and team logic
The team system relies on three core tables. The users table gains a current_team_id to track which workspace the user is currently viewing. The teams table stores the owner and the team name. Finally, team_invitations handles the state of pending members.
Under the hood, CreateNewUser action triggers a CreateTeam handle. This ensures every user has a personal "home" team by default, preventing null pointer errors when the application expects a team context.
Invitation workflows and role hierarchy
Accepting an invitation is currently a two-step process. A guest clicks a signed URL, which redirects them to a login or registration page. Once authenticated, the AcceptInvitation component validates the email match and attaches the user to the team. The system defines three specific roles:
- Owner: Full control over settings and deletion.
- Admin: Can rename teams and manage invitations.
- Member: Read-only access to team data.
Practical example: Role-based view logic
You can check permissions directly in your
@if (auth()->user()->ownsTeam($team))
<button wire:click="deleteTeam">Delete Team</button>
@endif
Tips and common gotchas
One notable quirk is the registration flow. If a user is invited via [email protected] but registers with a different email, they will not be automatically added to the team. Always ensure your users know the invitation is tied to the specific recipient email. Additionally, remember to run php artisan queue:work, as team invitations are dispatched as queued notifications by default.
