mirror of
https://github.com/stancl/tenancy-docs.git
synced 2025-12-12 02:04:03 +00:00
2.x creating tenants
This commit is contained in:
parent
9f5f98d776
commit
dcd7a47f2e
2 changed files with 12 additions and 6 deletions
|
|
@ -6,6 +6,11 @@ return [
|
|||
'siteName' => 'stancl/tenancy documentation',
|
||||
'siteDescription' => 'A Laravel multi-database tenancy package that respects your code.',
|
||||
|
||||
// key => display text
|
||||
'versions' => [
|
||||
'1.x' => '1.x',
|
||||
'2.x' => '2.x (beta)',
|
||||
],
|
||||
'defaultVersion' => '2.x',
|
||||
'prettyUrls' => true,
|
||||
|
||||
|
|
|
|||
|
|
@ -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 -->
|
||||
Loading…
Add table
Add a link
Reference in a new issue