2.x creating tenants

This commit is contained in:
Samuel Štancl 2019-09-18 15:45:39 +02:00
parent 9f5f98d776
commit dcd7a47f2e
2 changed files with 12 additions and 6 deletions

View file

@ -17,14 +17,15 @@ Tenant::new()->withDomains(['tenant1.yourapp.com'])->withData(['plan' => 'free']
> Tip: All domains under `.localhost` are routed to 127.0.0.1 on most operating systems. This is useful for development.
If you want to set some data while creating the tenant, you can pass an array with the data as the second argument:
The `withDomains()` and `withData()` methods are optional.
You can also create a tenant using the `Tenant::create` method:
```php
tenant()->create('tenant2.yourapp.com', [
'plan' => 'free'
$domains = ['tenant1.myapp.com', 'tenant1.com'];
Tenant::create($domains, [
'plan' => 'free',
]);
```
The `create` method returns an array with tenant information (`uuid`, `domain` and whatever else you supplied).
> Note: Creating a tenant doesn't run [migrations](https://stancl-tenancy.netlify.com/docs/console-commands/#migrate) automatically. You have to do that yourself.
> Note: Creating a tenant doesn't run [migrations](https://stancl-tenancy.netlify.com/docs/console-commands/#migrate) automatically. You have to do that yourself. <!-- TODO auto migrate after creation -->