mirror of
https://github.com/archtechx/tenancy.git
synced 2026-06-21 12:54:03 +00:00
Simplify tenancy boost resources by replacing detailed guidelines with focused references
This commit is contained in:
parent
882eaef8b4
commit
656bcda8c2
4 changed files with 135 additions and 843 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -84,11 +84,11 @@ That command publishes the config, routes, provider, core migrations, and create
|
||||||
## Core Working Pattern
|
## Core Working Pattern
|
||||||
|
|
||||||
1. Install the package and inspect `config/tenancy.php`.
|
1. Install the package and inspect `config/tenancy.php`.
|
||||||
2. Decide the tenant identification strategy first: domain, subdomain, domain-or-subdomain, path, request data, or origin header.
|
1. Decide the tenant identification strategy first: domain, subdomain, domain-or-subdomain, path, request data, or origin header.
|
||||||
3. Keep central and tenant routes explicit. Use the package middleware and route modes instead of ad hoc request checks.
|
1. Keep central and tenant routes explicit. Use the package middleware and route modes instead of ad hoc request checks.
|
||||||
4. Choose the minimum bootstrapper set that matches the app's infrastructure.
|
1. Choose the minimum bootstrapper set that matches the app's infrastructure.
|
||||||
5. For data isolation, decide between multi-database tenancy, single-database tenancy, or PostgreSQL RLS before writing application models.
|
1. For data isolation, decide between multi-database tenancy, single-database tenancy, or PostgreSQL RLS before writing application models.
|
||||||
6. Test both central and tenant contexts.
|
1. Test both central and tenant contexts.
|
||||||
|
|
||||||
## Tenant Identification
|
## Tenant Identification
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,13 +19,13 @@ Use this when installing or auditing `stancl/tenancy` setup.
|
||||||
composer require stancl/tenancy
|
composer require stancl/tenancy
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Run the installer non-interactively.
|
1. Run the installer non-interactively.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
php artisan tenancy:install --no-interaction
|
php artisan tenancy:install --no-interaction
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Confirm these files exist:
|
1. Confirm these files exist:
|
||||||
|
|
||||||
- `config/tenancy.php`
|
- `config/tenancy.php`
|
||||||
- `routes/tenant.php`
|
- `routes/tenant.php`
|
||||||
|
|
@ -34,19 +34,19 @@ php artisan tenancy:install --no-interaction
|
||||||
- `database/migrations/2019_09_15_000020_create_domains_table.php`
|
- `database/migrations/2019_09_15_000020_create_domains_table.php`
|
||||||
- `database/migrations/tenant`
|
- `database/migrations/tenant`
|
||||||
|
|
||||||
4. Review `config/tenancy.php` before running migrations.
|
1. Review `config/tenancy.php` before running migrations.
|
||||||
|
|
||||||
5. Run central migrations.
|
1. Run central migrations.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
php artisan migrate
|
php artisan migrate
|
||||||
```
|
```
|
||||||
|
|
||||||
6. Add tenant migrations to `database/migrations/tenant`.
|
1. Add tenant migrations to `database/migrations/tenant`.
|
||||||
|
|
||||||
7. Create tenants and domains according to the identification strategy.
|
1. Create tenants and domains according to the identification strategy.
|
||||||
|
|
||||||
8. Run tenant migrations.
|
1. Run tenant migrations.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
php artisan tenants:migrate
|
php artisan tenants:migrate
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ php artisan tenants:seed
|
||||||
php artisan tenants:run cache:clear
|
php artisan tenants:run cache:clear
|
||||||
php artisan tenant:tinker
|
php artisan tenant:tinker
|
||||||
php artisan tenants:list
|
php artisan tenants:list
|
||||||
php artisan tenant:dump
|
php artisan tenants:dump
|
||||||
```
|
```
|
||||||
|
|
||||||
## Maintenance And Storage
|
## Maintenance And Storage
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue