mirror of
https://github.com/stancl/tenancy-docs.git
synced 2025-12-12 18:24:03 +00:00
3.x redesign
This commit is contained in:
parent
857122540f
commit
f8f354c323
229 changed files with 201175 additions and 22440 deletions
34
source/docs/v2/features/tenant-config.blade.md
Normal file
34
source/docs/v2/features/tenant-config.blade.md
Normal file
|
|
@ -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.
|
||||
17
source/docs/v2/features/tenant-redirect.blade.md
Normal file
17
source/docs/v2/features/tenant-redirect.blade.md
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
title: Tenant Redirect
|
||||
description: Tenant Redirect
|
||||
extends: _layouts.documentation
|
||||
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
|
||||
// tenant sign up controller
|
||||
return redirect()->route('dashboard')->tenant($domain);
|
||||
```
|
||||
16
source/docs/v2/features/timestamps.blade.md
Normal file
16
source/docs/v2/features/timestamps.blade.md
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
title: Timestamps
|
||||
description: Timestamps
|
||||
extends: _layouts.documentation
|
||||
section: content
|
||||
---
|
||||
|
||||
# Timestamps {#timestamps-redirect}
|
||||
|
||||
> To enable this feature, uncomment the `Stancl\Tenancy\Features\Timestamps::class` line in your `tenancy.features` config.
|
||||
|
||||
This `Feature` adds the following timestamps into the tenant storage:
|
||||
|
||||
- `created_at`
|
||||
- `updated_at`
|
||||
- `deleted_at` - for soft deletes
|
||||
Loading…
Add table
Add a link
Reference in a new issue