tenancy-docs/docs/source/v2/creating-tenants.blade.md
Samuel Štancl ae63f30be6 New routes
2019-09-21 22:10:32 +02:00

986 B

title description extends section
Creating Tenants Creating tenants.. _layouts.documentation_v2 content

Creating Tenants

Make sure your database is correctly [configured]({{ $page->link('configuration/#database') }}) before creating tenants.

To create a tenant, you can use

Tenant::new()->withDomains(['tenant1.yourapp.com'])->withData(['plan' => 'free'])->save();

Tip: All domains under .localhost are routed to 127.0.0.1 on most operating systems. This is useful for development.

The withDomains() and withData() methods are optional.

You can also create a tenant using the Tenant::create method:

$domains = ['tenant1.myapp.com', 'tenant1.com'];
Tenant::create($domains, [
    'plan' => 'free',
]);

Note: Creating a tenant doesn't run migrations automatically. You have to do that yourself.