From 4ab5bbec0c4b583a95110453a0bdaed165f82712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Fri, 4 Oct 2019 21:58:29 +0200 Subject: [PATCH 1/4] capital C --- docs/source/v2/https-certificates.blade.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/v2/https-certificates.blade.md b/docs/source/v2/https-certificates.blade.md index 73945c3..29036a4 100644 --- a/docs/source/v2/https-certificates.blade.md +++ b/docs/source/v2/https-certificates.blade.md @@ -5,7 +5,7 @@ extends: _layouts.documentation section: content --- -# HTTPS certificates +# HTTPS Certificates HTTPS certificates are very easy to deal with if you use the `yourclient1.yourapp.com`, `yourclient2.yourapp.com` model. You can use a wildcard HTTPS certificate. From 31055aa9d60f853afe59ee9da894bd506765dd1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Fri, 4 Oct 2019 22:39:53 +0200 Subject: [PATCH 2/4] Tenant config --- docs/navigation.php | 1 + docs/source/v2/tenant-config.md | 34 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 docs/source/v2/tenant-config.md diff --git a/docs/navigation.php b/docs/navigation.php index 1d6d106..1677136 100644 --- a/docs/navigation.php +++ b/docs/navigation.php @@ -76,6 +76,7 @@ return [ 'url' => 'digging-deeper', 'children' => [ 'Tenants' => 'tenants', + 'Tenant Config' => 'tenant-config', 'Middleware Configuration' => 'middleware-configuration', 'Custom Database Names' => 'custom-database-names', 'Filesystem Tenancy' => 'filesystem-tenancy', diff --git a/docs/source/v2/tenant-config.md b/docs/source/v2/tenant-config.md new file mode 100644 index 0000000..8bdf0bf --- /dev/null +++ b/docs/source/v2/tenant-config.md @@ -0,0 +1,34 @@ +--- +title: Tenant Config +description: Tenant Config +extends: _layouts.documentation +section: content +--- + +# Tenant Config {#tenant-config} + +It's likely you will need to use tenant-specific config in your application. That config could be API keys, things like "products per page" and many other things. + +You could just use the [tenant storage]({{ $page->link('tenant-storage') }}) to get these values, but you may still want to use Laravel's `config()` because of: +- separation of concerns -- if you just write tenancy implementation-agnostic `config('shop.products_per_page')`, you will have a much better time changing tenancy implementations +- default values -- you may want to use the tenant storage only to override values in your config file + +## Enabling the feature + +Uncomment the following line in your `tenancy.features` config: +```php +// Stancl\Tenancy\Features\TenantConfig::class, +``` + +## Configuring the mappings + +This feature maps keys in the tenant storage to config keys based on the `tenancy.storage_to_config_map` config. + +For example, if your `storage_to_config_map` looked like this: +```php +'storage_to_config_map' => [ + 'paypal_api_key' => 'services.paypal.api_key', +], +``` + +the value of `paypal_api_key` in [tenant storage]({{ $page->link('tenant-storage') }}) would be copied to the `services.paypal.api_key` config when tenancy is initialized. From bc43701c2082e84174fd1e402380dd972135ecda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Fri, 4 Oct 2019 22:45:43 +0200 Subject: [PATCH 3/4] .md -> .blade.md --- docs/source/v2/{tenant-config.md => tenant-config.blade.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/source/v2/{tenant-config.md => tenant-config.blade.md} (100%) diff --git a/docs/source/v2/tenant-config.md b/docs/source/v2/tenant-config.blade.md similarity index 100% rename from docs/source/v2/tenant-config.md rename to docs/source/v2/tenant-config.blade.md From 8a955c7772e2025a8952b0b8f95be93d2c9caf31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Fri, 4 Oct 2019 22:54:28 +0200 Subject: [PATCH 4/4] Features are disabled by default --- docs/source/v2/misc-tips.blade.md | 2 ++ docs/source/v2/telescope.blade.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/docs/source/v2/misc-tips.blade.md b/docs/source/v2/misc-tips.blade.md index d938778..0d699f0 100644 --- a/docs/source/v2/misc-tips.blade.md +++ b/docs/source/v2/misc-tips.blade.md @@ -9,6 +9,8 @@ section: content ## Tenant Redirect {#tenant-redirect} +> To enable this feature, uncomment the `Stancl\Tenancy\Features\TenantRedirect::class` line in your `tenancy.features` config. + A customer has signed up on your website, you have created a new tenant and now you want to redirect the customer to their website. You can use the `tenant()` method on Redirect, like this: ```php diff --git a/docs/source/v2/telescope.blade.md b/docs/source/v2/telescope.blade.md index 18fa3bf..2d54436 100644 --- a/docs/source/v2/telescope.blade.md +++ b/docs/source/v2/telescope.blade.md @@ -7,6 +7,8 @@ section: content # Telescope Integration +> To enable this feature, uncomment the `Stancl\Tenancy\Features\TelescopeTags::class` line in your `tenancy.features` config. + Requests in Telescope are automatically tagged with the tenant id and domain: ![Telescope Request with tags](https://i.imgur.com/CEEluYj.png)