1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 08:14:02 +00:00
tenancy/source/docs/creating-tenants.md
Samuel Štancl aa3f9bce6f wip
2019-08-17 16:08:50 +02:00

28 lines
No EOL
922 B
Markdown

---
title: Creating Tenants
description: Creating tenants with stancl/tenancy — A Laravel multi-database tenancy package that respects your code..
extends: _layouts.documentation
section: content
---
# Creating Tenants {#creating-tenants}
> **Make sure your database is correctly [configured](/docs/configuration/#database) before creating tenants.**
To create a tenant, you can use
```php
tenant()->create('tenant1.yourapp.com');
```
> 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:
```php
tenant()->create('tenant2.yourapp.com', [
'plan' => 'free'
]);
```
> Note: Creating a tenant doesn't run [migrations](https://stancl-tenancy.netlify.com/docs/console-commands/#migrate) automatically. You have to do that yourself.