mirror of
https://github.com/stancl/tenancy-docs.git
synced 2025-12-12 10:14:03 +00:00
* add Laravel Orchid integration * add the path to the "home" route for central application * fix link to Universal Routes * fixed formatting (lots of spaces) Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
1.9 KiB
1.9 KiB
| title | extends | section |
|---|---|---|
| Laravel Orchid integration | _layouts.documentation | content |
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. All the steps have also been completed Quickstart Tutorial.
-
To use Orchid both in the central & tenant parts you need to enable [Universal Routes]({{ $page->link('features/universal-routes') }}).
-
Add the tenancy middleware to your
config\platform.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.phpRoute::screen('/', PlatformScreen::class) ->name('platform.index') ->breadcrumbs(function (Trail $trail) { return $trail->push(__('Home'), route('platform.index')); }); -
In the file
app\Providers\RouteServiceProvider.php, if necessary, change the path to the "home" route for your central application. By default for Orchid it will be'admin/main'public const HOME = 'admin/main'; -
Tenant Routes
routes\tenant.phpRoute::middleware([ 'web', 'platform', InitializeTenancyByDomain::class, PreventAccessFromCentralDomains::class, ])->prefix(Orchid\Platform\Dashboard::prefix('/'))->group(function () { Route::get('/', function () { return 'This is your multi-tenant application. The id of the current tenant is ' . tenant('id'); }); });