Loading...

This is taking longer than expected.

Back to the help centre

Configure teams

The config keys and environment variables the team layer adds, with what each one changes.

The team layer is configured by a handful of keys on top of the base's. Everything below has a working default: change a key only when your product needs the other behaviour. The base's own keys are documented on its site, in The environment file and Configure your project.

Environment variables

Variable Default What it does
APP_ENABLE_MULTI_TEAMS true Whether a person can create and belong to several teams. With false the switcher is skipped and the person is sent to their only team.
TEAM_INVITATION_MODE approval_required What happens when a member is added who has no account: approval_required invites them to register, auto_provision creates the account. See Members and invitations.
BILLING_TEAM_ENABLED true Registers the team billing adapter, so plans and add-ons attach to the team.
BILLING_USER_ENABLED false Registers the base's user billing adapter next to the team's, for a product that sells to people and to teams. See Team plans and billing.

The base's FEATURE_PLANS_ENABLED and FEATURE_ADDONS_ENABLED still decide whether plans and add-ons exist at all.

config/app.php

'home_route' => '/app',
'enable_multi_teams' => env('APP_ENABLE_MULTI_TEAMS', true),

'permissions' => [
    'dashboard admin' => 'web',
    'dashboard user' => 'web',

    'retrieve members' => 'team',
    'create members' => 'team',
    'update members' => 'team',
    'delete members' => 'team',
    'edit settings' => 'team',
    'manage plans' => 'team',
],

'team_owner_role' => 'administrator',
'team_default_role' => 'user',
'team_roles' => [
    'user' => [
        'retrieve members',
    ],
],
Key What it does
home_route Where a signed-in person lands: the team switcher. The base sets it to its own dashboard.
enable_multi_teams Read from APP_ENABLE_MULTI_TEAMS, above.
permissions Every permission, with its guard. The six on the team guard are the ones the shipped screens check; add yours here with 'team' as the guard and seed.
team_owner_role The name of the role created in each team with every team permission, assigned to the creator.
team_default_role The role every member added later receives. It must be one of the keys of team_roles.
team_roles The roles created inside each new team, each with the permissions it starts with.

See Team roles and permissions for how these three play together.

config/teams.php

'invitation_mode' => env('TEAM_INVITATION_MODE', 'approval_required'),

The one key the file has, read from the variable above.

config/permission.php

'teams' => true,
'column_names' => [
    'team_foreign_key' => 'team_id',
],

Spatie Permission's teams mode, already on. team_id is the column added to roles, model_has_roles and model_has_permissions by the kit's migrations, and the value 0 in it means the global context of the admin panel. Leave both as they are unless you rename the column, in which case rename it in the migrations too.

packages/billing-team/config/billing-team.php

'enabled' => env('BILLING_TEAM_ENABLED', true),
'model' => App\Models\Team::class,
'owner_resolver' => null,
'plan_limits' => App\Classes\TeamPlanLimits::class,
'plan_features' => App\Classes\TeamPlanFeatures::class,
'user_billing_enabled' => env('BILLING_USER_ENABLED', false),
Key What it does
enabled Read from BILLING_TEAM_ENABLED.
model The model that owns a billing account: the team.
owner_resolver A class that answers which team is being billed in the current request. null uses the team() helper, which is right for every screen under /team.
plan_limits The class whose public methods count each limit for a team.
plan_features The class whose public methods declare the capabilities a team can buy.
user_billing_enabled Read from BILLING_USER_ENABLED.

What stays as in the base

Sign-in identities, verification, mail, SMS, storage, the AI provider, tracking, referrals and the public site keep the base's keys and meaning. Nothing about a team changes how a person signs in or which language they read.