From 67371725890f575fed3ee59d73631d3d023986fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Tue, 20 Aug 2019 11:45:19 +0200 Subject: [PATCH] tenant specific config --- source/docs/event-system.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source/docs/event-system.md b/source/docs/event-system.md index a6e0a675..55b4c2ee 100644 --- a/source/docs/event-system.md +++ b/source/docs/event-system.md @@ -17,7 +17,7 @@ The following events are available: You can hook into these events using `Tenancy::`: ```php -Tenancy::boostrapping(function ($tenantManager) { +\Tenancy::boostrapping(function ($tenantManager) { if ($tenantManager->tenant['uuid'] === 'someUUID') { config(['database.connections.someDatabaseConnection' => $tenantManager->tenant['databaseConnection']]); $tenantManager->database->useConnection('someDatabaseConnection'); @@ -33,4 +33,11 @@ The following actions can be prevented: - database connection switch: `database` - Redis prefix: `redis` - CacheManager switch: `cache` -- Filesystem changes: `filesystem` \ No newline at end of file +- Filesystem changes: `filesystem` + +Another common use case for events is tenant-specific config: +```php +\Tenancy::bootstrapped(function ($tenantManager) { + config(['some.api.key' => $tenantManager->tenant['api_key']); +}); +``` \ No newline at end of file