{"record":{"id":"fadb75987cbf10dc","repo":"spatie/laravel-permission","slug":"please-enable-the-teams-setting-in-your-configurat","errorCode":null,"errorMessage":"Please enable the teams setting in your configuration.","messagePattern":"Please enable the teams setting in your configuration\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/Commands/UpgradeForTeamsCommand.php","lineNumber":20,"sourceCode":"\nnamespace Spatie\\Permission\\Commands;\n\nuse Illuminate\\Console\\Command;\nuse Illuminate\\Support\\Facades\\Config;\n\nclass UpgradeForTeamsCommand extends Command\n{\n    protected $signature = 'permission:setup-teams';\n\n    protected $description = 'Setup the teams feature by generating the associated migration.';\n\n    protected string $migrationSuffix = 'add_teams_fields.php';\n\n    public function handle(): int\n    {\n        if (! Config::get('permission.teams')) {\n            $this->error('Teams feature is disabled in your permission.php file.');\n            $this->warn('Please enable the teams setting in your configuration.');\n\n            return self::FAILURE;\n        }\n\n        $this->line('');\n        $this->info('The teams feature setup is going to add a migration and a model');\n\n        $existingMigrations = $this->alreadyExistingMigrations();\n\n        if ($existingMigrations) {\n            $this->line('');\n\n            $this->warn($this->getExistingMigrationsWarning($existingMigrations));\n        }\n\n        $this->line('');\n\n        if (! $this->confirm('Proceed with the migration creation?', true)) {","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/spatie/laravel-permission/blob/afd24018f68306e8b43ace487c107a59af1be776/src/Commands/UpgradeForTeamsCommand.php#L2-L38","documentation":"The permission:setup-teams Artisan command generates the add_teams_fields migration and the teams-enabled model setup. It refuses to run while Config::get('permission.teams') is falsy: it prints an error line ('Teams feature is disabled in your permission.php file.'), then this warning, and exits with FAILURE. Generating teams migrations while the feature flag is off would leave the schema and the configuration inconsistent, so the command aborts up front.","triggerScenarios":"Running `php artisan permission:setup-teams` before enabling teams in config/permission.php. The check reads the live config, so it also fires when the config file was never published (framework default 'teams' => false) or when a stale config cache still holds teams=false after an edit.","commonSituations":"vendor:publish was never run, so no config/permission.php exists and the default false applies; the developer edited config/permission.php but forgot `php artisan config:clear`, so the cached copy still says false; the project's .env sets PERMISSION_TEAMS=true but the published config hardcodes 'teams' => false instead of reading the env var.","solutions":["Set 'teams' => true in config/permission.php and re-run php artisan permission:setup-teams","If config/permission.php does not exist, publish it first: php artisan vendor:publish --provider=\"Spatie\\Permission\\PermissionServiceProvider\"","If you edited the config but the warning persists, clear the config cache: php artisan config:clear","If your published config reads the env var, set PERMISSION_TEAMS=true in .env and run php artisan config:clear"],"exampleFix":"// before — config/permission.php\n'teams' => false,\n\n// after\n'teams' => true,\n// then: php artisan config:clear && php artisan permission:setup-teams","handlingStrategy":"validation","validationCode":"// before running the command (script or code)\nif (! config('permission.teams')) {\n    throw new RuntimeException('Enable permission.teams (config/permission.php) before running permission:setup-teams.');\n}\n$exit = \\Illuminate\\Support\\Facades\\Artisan::call('permission:setup-teams');\nif ($exit !== \\Illuminate\\Console\\Command::SUCCESS) {\n    // handle failure\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Publish and commit config/permission.php so the teams flag is explicit in every environment","Run php artisan config:clear after any permission config change (and config:cache again in production)","In deploy scripts, gate the command on config('permission.teams') and always check the exit code — the command exits FAILURE when disabled"],"tags":["laravel","artisan","spatie-permission","teams","configuration","multi-tenant"],"backgroundTag":"missing-config-setting","analyzedSha":"afd24018f68306e8b43ace487c107a59af1be776","analyzedAt":"2026-08-21T01:13:42.706Z","schemaVersion":2},"datasetVersion":"2026-08-21T03:17:12.404Z"}