2.x config

This commit is contained in:
Samuel Štancl 2019-09-21 23:57:14 +02:00
parent ae63f30be6
commit 667467ddc4
5 changed files with 82 additions and 19 deletions

View file

@ -7,16 +7,18 @@ section: content
# Installation {#getting-started}
Laravel 5.8 or higher is needed.
Laravel 6.0 or higher is needed.
### Require the package via composer
First you need to require the package using composer:
```
composer require stancl/tenancy
composer require stancl/tenancy:2.x-dev
```
> **Note:** Be sure to `composer require stancl/tenancy` (without the `:2.x-dev`) once 2.0.0 is released. <!-- todo2 -->
### Automatic installation {#automatic-installation}
To install the package, simply run
@ -25,11 +27,9 @@ To install the package, simply run
php artisan tenancy:install
```
You will be asked if you want to store your data in Redis or a relational database. You can read more about this on the [Storage Drivers]({{ $page->link('storage-drivers') }}) page.
This will do all the steps listed in the [Manual installation](#manual-installation) section for you.
The only thing you have to do now is create a database/Redis connection. Read the [Storage Drivers]({{ $page->link('storage-drivers') }}) page for information about that.
You will be asked if you want to store your data in a relational database or Redis. Continue to the next page ([Storage Drivers]({{ $page->link('storage-drivers') }})) to know what that means.
### Manual installation {#manual-installation}
@ -37,10 +37,11 @@ If you prefer installing the package manually, you can do that too. It shouldn't
#### Setting up middleware
Now open `app/Http/Kernel.php` and make the `InitializeTenancy` middleware top priority, so that it gets executed before anything else, making sure things like the database switch connections soon enough:
Now open `app/Http/Kernel.php` and make the package's middleware classes top priority, so that they get executed before anything else, making sure things like the database switch connections soon enough:
```php
protected $middlewarePriority = [
\Stancl\Tenancy\Middleware\PreventAccessFromTenantDomains::class,
\Stancl\Tenancy\Middleware\InitializeTenancy::class,
// ...
];
@ -50,7 +51,7 @@ protected $middlewarePriority = [
The package lets you have tenant routes and "exempt" routes. Tenant routes are your application's routes. Exempt routes are routes exempt from tenancy — landing pages, sign up forms, and routes for managing tenants.
Routes in `routes/web.php` are exempt, whereas routes in `routes/tenant.php` have the `InitializeTenancy` middleware automatically applied on them.
Routes in `routes/web.php` are exempt, while routes in `routes/tenant.php` have the tenancy middleware automatically applied to them.
So, to create tenant routes, put those routes in a new file called `routes/tenant.php`.