mirror of
https://github.com/stancl/tenancy-docs.git
synced 2025-12-12 18:24:03 +00:00
Improved Documentation Search (#61)
* chore: (Improve documentation search for V3) * fix: checks for mispelled words * fix: mispelled words * fix spaces and syntax * Update multi-database-tenancy.blade.md Co-authored-by: Samuel Stancl <samuel.stancl@gmail.com>
This commit is contained in:
parent
0549607899
commit
a4645b3abd
42 changed files with 158 additions and 158 deletions
|
|
@ -4,7 +4,7 @@ extends: _layouts.documentation
|
|||
section: content
|
||||
---
|
||||
|
||||
# Cross-domain redirect
|
||||
# Cross-domain redirect {#cross-domain-redirect}
|
||||
|
||||
To enable this feature, uncomment the `Stancl\Tenancy\Features\CrossDomainRedirect::class` line in your `tenancy.features` config.
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,6 @@ extends: _layouts.documentation
|
|||
section: content
|
||||
---
|
||||
|
||||
# Telescope tags
|
||||
# Telescope tags {#telescope-tags}
|
||||
|
||||
TODO
|
||||
|
|
@ -4,7 +4,7 @@ extends: _layouts.documentation
|
|||
section: content
|
||||
---
|
||||
|
||||
# Tenant config
|
||||
# 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.
|
||||
|
||||
|
|
@ -13,7 +13,7 @@ You could just use the the tenant model to get these values, but you may still
|
|||
- 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**
|
||||
## **Enabling the feature** {#enabling-the-feature}
|
||||
|
||||
Uncomment the following line in your `tenancy.features` config:
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ Uncomment the following line in your `tenancy.features` config:
|
|||
// Stancl\Tenancy\Features\TenantConfig::class,
|
||||
```
|
||||
|
||||
## **Configuring the mappings**
|
||||
## **Configuring the mappings** {#configuring-the-mappings}
|
||||
|
||||
This feature maps keys in the tenant storage to config keys based on the `$storageToConfigMap` public property.
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ For example, if your `$storageToConfigMap` looked like this:
|
|||
|
||||
the value of `paypal_api_key` in tenant model would be copied to the `services.paypal.api_key` config when tenancy is initialized.
|
||||
|
||||
## Mapping the value to multiple config keys
|
||||
## Mapping the value to multiple config keys {#mapping-the-value-to-multiple-config-keys}
|
||||
|
||||
Sometimes you may want to copy the value to multiple config keys. To do that, specify the config keys as an array:
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ extends: _layouts.documentation
|
|||
section: content
|
||||
---
|
||||
|
||||
# Universal Routes
|
||||
# Universal Routes {#universal-routes}
|
||||
|
||||
> Note: If you need custom [onFail]({{ $page->link('tenant-identification') }}) logic, you cannot use this feature as it will override any of your changes to that logic. Instead, look into the source code of this feature and make your onFail logic implement universal routes too.
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ extends: _layouts.documentation
|
|||
section: content
|
||||
---
|
||||
|
||||
# User impersonation
|
||||
# User impersonation {#user-impersonation}
|
||||
|
||||
This package comes with a feature that lets you impersonate users inside tenant databases. This feature works with **any identification method** and **any auth guard** — even if you use multiple.
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ And finally, run the migration:
|
|||
php artisan migrate
|
||||
```
|
||||
|
||||
## Usage
|
||||
## Usage {#usage}
|
||||
|
||||
First, you need to create a tenant route that looks like this:
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ $token = tenancy()->impersonate($tenant, $user->id, $redirectUrl);
|
|||
|
||||
And redirect the user (or, presumably an "admin") to the route you created.
|
||||
|
||||
### Domain identification
|
||||
### Domain identification {#domain-identification}
|
||||
|
||||
```jsx
|
||||
// Note: This is not part of the package, it's up to you to implement
|
||||
|
|
@ -89,7 +89,7 @@ $domain = $tenant->primary_domain;
|
|||
return redirect("https://$domain/impersonate/{$token->token}");
|
||||
```
|
||||
|
||||
### Path identification
|
||||
### Path identification {#path-identification}
|
||||
|
||||
```jsx
|
||||
// Make sure you use the correct prefix for your routes.
|
||||
|
|
@ -98,7 +98,7 @@ return redirect("{$tenant->id}/impersonate/{$token->token}");
|
|||
|
||||
And that's it. The user will be redirected to your impersonation route, logged in as the impersonated user, and finally redirected to your redirect URL.
|
||||
|
||||
### Custom auth guards
|
||||
### Custom auth guards {#custom-auth-guards}
|
||||
|
||||
If you're using multiple auth guards, you may want to specify what auth guard the impersonation logic should use.
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ To do this, simply pass the auth guard name as the fourth argument to the `imper
|
|||
tenancy()->impersonate($tenant, $user->id, $redirectUrl, 'jwt');
|
||||
```
|
||||
|
||||
## Customization
|
||||
## Customization {#customization}
|
||||
|
||||
You may customize the TTL of impersonation tokens by setting the following static property to the amount of seconds you want to use:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue