mirror of
https://github.com/stancl/tenancy-docs.git
synced 2025-12-12 10:14:03 +00:00
New routes
This commit is contained in:
parent
478452d1eb
commit
ae63f30be6
68 changed files with 346 additions and 215 deletions
31
docs/source/v2/creating-tenants.blade.md
Normal file
31
docs/source/v2/creating-tenants.blade.md
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
title: Creating Tenants
|
||||
description: Creating tenants..
|
||||
extends: _layouts.documentation_v2
|
||||
section: content
|
||||
---
|
||||
|
||||
# Creating Tenants {#creating-tenants}
|
||||
|
||||
> **Make sure your database is correctly [configured]({{ $page->link('configuration/#database') }}) before creating tenants.**
|
||||
|
||||
To create a tenant, you can use
|
||||
|
||||
```php
|
||||
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:
|
||||
|
||||
```php
|
||||
$domains = ['tenant1.myapp.com', 'tenant1.com'];
|
||||
Tenant::create($domains, [
|
||||
'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. <!-- TODO auto migrate after creation -->
|
||||
Loading…
Add table
Add a link
Reference in a new issue