mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 09:54:03 +00:00
Add a section on creating a Redis connection for tenancy data
This commit is contained in:
parent
deb3ad77f5
commit
893f664934
1 changed files with 19 additions and 0 deletions
19
README.md
19
README.md
|
|
@ -131,6 +131,25 @@ You can see an example in the [Filesystem](#Filesystem) section of the documenta
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
|
## Creating a Redis connection for storing tenancy-related data
|
||||||
|
|
||||||
|
Add an array like this to `database.redis` config:
|
||||||
|
|
||||||
|
```
|
||||||
|
'tenancy' => [
|
||||||
|
'host' => env('REDIS_TENANCY_HOST', '127.0.0.1'),
|
||||||
|
'password' => env('REDIS_TENANCY_PASSWORD', null),
|
||||||
|
'port' => env('REDIS_TENANCY_PORT', 6380),
|
||||||
|
'database' => env('REDIS_TENANCY_DB', 3),
|
||||||
|
],
|
||||||
|
```
|
||||||
|
|
||||||
|
Note the different `database` number and the different port.
|
||||||
|
|
||||||
|
A different port is used in this example, because if you use Redis for caching, you may want to run one instance with no persistence and another instance with persistence for tenancy-related data. If you want to run only one Redis instance, just make sure you use a different database number to avoid collisions.
|
||||||
|
|
||||||
|
Read the [Storage driver](#storage-driver) section for more information.
|
||||||
|
|
||||||
## Obtaining a `TenantManager` instance
|
## Obtaining a `TenantManager` instance
|
||||||
|
|
||||||
You can use the `tenancy()` and `tenant()` helpers to resolve `Stancl\Tenancy\TenantManager` out of the service container. These two helpers are exactly the same, the only reason there are two is nice syntax. `tenancy()->init()` sounds better than `tenant()->init()` and `tenant()->create()` sounds better than `tenancy()->create()`.
|
You can use the `tenancy()` and `tenant()` helpers to resolve `Stancl\Tenancy\TenantManager` out of the service container. These two helpers are exactly the same, the only reason there are two is nice syntax. `tenancy()->init()` sounds better than `tenant()->init()` and `tenant()->create()` sounds better than `tenancy()->create()`.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue