From 0de58eb6d5cbde2b244889d5b29d15b3e4911f74 Mon Sep 17 00:00:00 2001 From: Impeck Date: Fri, 8 Apr 2022 16:28:59 +0500 Subject: [PATCH] add Laravel Orchid integration --- navigation.php | 3 +- source/docs/v3/integrations/orchid.blade.md | 42 +++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 source/docs/v3/integrations/orchid.blade.md diff --git a/navigation.php b/navigation.php index 5220d3f..a010f94 100644 --- a/navigation.php +++ b/navigation.php @@ -66,7 +66,7 @@ return [ 'url' => 'usage', 'children' => [ 'Creating Tenants' => 'creating-tenants', - 'Tenant Migrations'=> 'tenant-migrations', + 'Tenant Migrations' => 'tenant-migrations', 'Tenant Routes' => 'tenant-routes', 'Tenant Storage' => 'tenant-storage', 'Tenant Manager' => 'tenant-manager', @@ -205,6 +205,7 @@ return [ 'Nova' => 'integrations/nova', 'Telescope' => 'integrations/telescope', 'Livewire' => 'integrations/livewire', + 'Orchid' => 'integrations/orchid', ], ], 'Console commands' => 'console-commands', diff --git a/source/docs/v3/integrations/orchid.blade.md b/source/docs/v3/integrations/orchid.blade.md new file mode 100644 index 0000000..0637898 --- /dev/null +++ b/source/docs/v3/integrations/orchid.blade.md @@ -0,0 +1,42 @@ +--- +title: Laravel Orchid integration +extends: _layouts.documentation +section: content +--- + +# Laravel Orchid {#laravel-orchid} +The instruction is written for a newly installed Orchid platform, it is proposed to use the platform as a central application and the tenant app. + +## Both in the central app and the tenant app + +Laravel Orchid has already been installed according to the [documentation Orchid](https://orchid.software/en/docs/installation/). All the steps have also been completed [Quickstart Tutorial](/docs/v3/quickstart). + +- To use Orchid both in the central & tenant parts you need to enable [Universal Routes](docs/v3/features/universal-routes). +- Add the tenancy middleware to your `config\platform.php` + ```php + 'middleware' => [ + 'public' => ['web', 'universal', \Stancl\Tenancy\Middleware\InitializeTenancyByDomain::class], + 'private' => ['web', 'platform', 'universal', \Stancl\Tenancy\Middleware\InitializeTenancyByDomain::class], + ], + ``` +- Add a route to `routes\platform.php` + ```php + Route::screen('/', PlatformScreen::class) + ->name('platform.index') + ->breadcrumbs(function (Trail $trail) { + return $trail->push(__('Home'), route('platform.index')); + }); + ``` +- Tenant Routes `routes\tenant.php` + ```php + Route::middleware([ + 'web', + 'platform', + InitializeTenancyByDomain::class, + PreventAccessFromCentralDomains::class, + ])->prefix('admin')->group(function () { + Route::get('/', function () { + return 'This is your multi-tenant application. The id of the current tenant is ' . tenant('id'); + }); + }); + ``` \ No newline at end of file