From c69505a09a03691820abd0096ca846794f078082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Sun, 10 Nov 2019 15:42:13 +0100 Subject: [PATCH] Features --- docs/navigation.php | 9 ++++++++- docs/source/v2/configuration.blade.md | 2 +- docs/source/v2/features.blade.md | 12 ++++++++++++ .../v2/{ => features}/tenant-config.blade.md | 0 .../source/v2/features/tenant-redirect.blade.md | 17 +++++++++++++++++ docs/source/v2/features/timestamps.blade.md | 12 ++++++++++++ docs/source/v2/misc-tips.blade.md | 11 ----------- docs/source/v2/upgrading.blade.md | 2 +- 8 files changed, 51 insertions(+), 14 deletions(-) create mode 100644 docs/source/v2/features.blade.md rename docs/source/v2/{ => features}/tenant-config.blade.md (100%) create mode 100644 docs/source/v2/features/tenant-redirect.blade.md create mode 100644 docs/source/v2/features/timestamps.blade.md diff --git a/docs/navigation.php b/docs/navigation.php index 7661950..064cd9a 100644 --- a/docs/navigation.php +++ b/docs/navigation.php @@ -78,7 +78,6 @@ return [ 'children' => [ 'Tenants' => 'tenants', 'Central App' => 'central-app', - 'Tenant Config' => 'tenant-config', 'Middleware Configuration' => 'middleware-configuration', 'Custom Database Names' => 'custom-database-names', 'Custom DB Connections' => 'custom-db-connections', @@ -91,6 +90,14 @@ return [ 'Writing Storage Drivers' => 'writing-storage-drivers', ], ], + 'Optional Features' => [ + 'url' => 'features', + 'children' => [ + 'Tenant Config' => 'features/tenant-config', + 'Timestamps' => 'features/timestamps', + 'Tenant Redirect' => 'features/tenant-redirect', + ], + ], 'Integrations' => [ 'url' => 'integrations', 'children' => [ diff --git a/docs/source/v2/configuration.blade.md b/docs/source/v2/configuration.blade.md index 6652787..2b48df3 100644 --- a/docs/source/v2/configuration.blade.md +++ b/docs/source/v2/configuration.blade.md @@ -92,7 +92,7 @@ The aliases are used by the [event system]({{ $page->link('hooks') }}) ### `features` {#bootstrappers} -Features are similar to bootstrappers, but they are executed regardless of whether tenancy has been initialized or not. Their purpose is to provide additional functionality beyond what is necessary for the package to work. Things like easy redirects to tenant domains, tags in Telescope, etc. +[Features]({{ $page->link('optional-features') }}) are similar to bootstrappers, but they are executed regardless of whether tenancy has been initialized or not. Their purpose is to provide additional functionality beyond what is necessary for the package to work. Things like easy redirects to tenant domains, tags in Telescope, etc. ### `home_url` {#home-url} diff --git a/docs/source/v2/features.blade.md b/docs/source/v2/features.blade.md new file mode 100644 index 0000000..f546c90 --- /dev/null +++ b/docs/source/v2/features.blade.md @@ -0,0 +1,12 @@ +--- +title: Optional Features +description: Optional Features +extends: _layouts.documentation +section: content +--- + +# Optional Features {#optional-features} + +Similarly to [TenancyBootstrappers]({{ $page->link('tenancy-bootstrappers') }}), `Features` are classes that provide extra functionality and can be enabled in the config. They're all disabled by default, because they're not critical to the core tenancy scaffolding. + +You may enable and disable `Features` in the `tenancy.features` configuration. diff --git a/docs/source/v2/tenant-config.blade.md b/docs/source/v2/features/tenant-config.blade.md similarity index 100% rename from docs/source/v2/tenant-config.blade.md rename to docs/source/v2/features/tenant-config.blade.md diff --git a/docs/source/v2/features/tenant-redirect.blade.md b/docs/source/v2/features/tenant-redirect.blade.md new file mode 100644 index 0000000..13c64a6 --- /dev/null +++ b/docs/source/v2/features/tenant-redirect.blade.md @@ -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); +``` \ No newline at end of file diff --git a/docs/source/v2/features/timestamps.blade.md b/docs/source/v2/features/timestamps.blade.md new file mode 100644 index 0000000..a275e5b --- /dev/null +++ b/docs/source/v2/features/timestamps.blade.md @@ -0,0 +1,12 @@ +--- +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. + +TODO diff --git a/docs/source/v2/misc-tips.blade.md b/docs/source/v2/misc-tips.blade.md index 85e8661..dfee45d 100644 --- a/docs/source/v2/misc-tips.blade.md +++ b/docs/source/v2/misc-tips.blade.md @@ -7,17 +7,6 @@ section: content # Miscellaneous Tips {#misc-tips} -## 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); -``` - ## Custom ID scheme If you don't want to use UUIDs and want to use something more human-readable (even domain concatenated with uuid, for example), you can create a custom class for this: diff --git a/docs/source/v2/upgrading.blade.md b/docs/source/v2/upgrading.blade.md index 48523be..b504874 100644 --- a/docs/source/v2/upgrading.blade.md +++ b/docs/source/v2/upgrading.blade.md @@ -51,6 +51,6 @@ If you're coming from 1.x, it's recommended to read (or at least skim through) t ## New Features -- [Tenant Config]({{ $page->link('tenant-config') }}) +- [Tenant Config]({{ $page->link('features/tenant-config') }}) - [Migrate Fresh]({{ $page->link('console-commands#migrate-fresh') }}) - [`tenants:create`]({{ $page->link('console-commands#create-tenant') }})