1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 03:54:04 +00:00

Merge branch '1.x' into db-storage-driver

This commit is contained in:
Samuel Štancl 2019-08-13 22:23:36 +02:00
commit 23dd42899a
6 changed files with 120 additions and 10 deletions

View file

@ -217,6 +217,32 @@ You can use the `tenancy()` and `tenant()` helpers to resolve `Stancl\Tenancy\Te
]
```
You can also put data into the storage during the tenant creation process:
```php
>>> tenant()->create('dev.localhost', [
'plan' => 'basic'
])
=> [
"uuid" => "49670df0-1a87-11e9-b7ba-cf5353777957",
"domain" => "dev.localhost",
"plan" => "basic",
]
```
If you want to specify the tenant's database name, set the `tenancy.database_name_key` configuration key to the name of the key that is used to specify the database name in the tenant storage. You must use a name that you won't use for storing other data, so it's recommended to avoid names like `database` and use names like `_stancl_tenancy_database_name` instead. Then just give the key a value during the tenant creation process:
```php
>>> tenant()->create('example.com', [
'_stancl_tenancy_database_name' => 'example_com'
])
=> [
"uuid" => "49670df0-1a87-11e9-b7ba-cf5353777957",
"domain" => "example.com",
"_stancl_tenancy_database_name" => "example_com",
]
```
When you create a new tenant, you can [migrate](#tenant-migrations) their database like this:
```php