mirror of
https://github.com/archtechx/tenancy.git
synced 2026-06-21 03:04:04 +00:00
2 KiB
2 KiB
Installation Reference
Use this when installing or auditing stancl/tenancy setup.
Source Files
src/Commands/Install.phpsrc/TenancyServiceProvider.phpassets/config.phpassets/tenant_routes.stub.phpassets/TenancyServiceProvider.stub.phpassets/migrations/*
Required Steps
- Install the package.
composer require stancl/tenancy
- Run the installer non-interactively.
php artisan tenancy:install --no-interaction
- Confirm these files exist:
config/tenancy.phproutes/tenant.phpapp/Providers/TenancyServiceProvider.phpdatabase/migrations/2019_09_15_000010_create_tenants_table.phpdatabase/migrations/2019_09_15_000020_create_domains_table.phpdatabase/migrations/tenant
-
Review
config/tenancy.phpbefore running migrations. -
Run central migrations.
php artisan migrate
-
Add tenant migrations to
database/migrations/tenant. -
Create tenants and domains according to the identification strategy.
-
Run tenant migrations.
php artisan tenants:migrate
Manual Publish Commands
Prefer tenancy:install. Use these only for targeted publishing:
php artisan vendor:publish --provider="Stancl\Tenancy\TenancyServiceProvider" --tag=config
php artisan vendor:publish --provider="Stancl\Tenancy\TenancyServiceProvider" --tag=routes
php artisan vendor:publish --provider="Stancl\Tenancy\TenancyServiceProvider" --tag=providers
php artisan vendor:publish --provider="Stancl\Tenancy\TenancyServiceProvider" --tag=migrations
php artisan vendor:publish --provider="Stancl\Tenancy\TenancyServiceProvider" --tag=impersonation-migrations
php artisan vendor:publish --provider="Stancl\Tenancy\TenancyServiceProvider" --tag=resource-syncing-migrations
Installer Behavior
- Publishes config, routes, provider, and base migrations.
- Creates
database/migrations/tenant. - Skips files that already exist and warns instead of overwriting.
- Shows an interactive support prompt unless
--no-interactionis used.