tenancy-docs/source/docs/v3/integrations/orchid.blade.md
lukinovec 99c18420d9
Improve Orchid integration docs page
Rewrote the docs and removed some bits because they seemed extra (like changing `HOME` or prefixing the tenant routes).
2022-07-15 08:09:32 +02:00

45 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Laravel Orchid integration
extends: _layouts.documentation
section: content
---
# Laravel Orchid {#laravel-orchid}
First, set up tenancy following the [quickstart guide](/docs/v3/quickstart), and install [Laravel Orchid](https://orchid.software/en/docs/installation/).
To use Orchid both in the central & tenant apps:
Copy the user and Orchid migrations to `migrations\tenant`
- Enable [universal routes]({{ $page->link('features/universal-routes') }})
- Add your tenant identification middleware to `config\platform.php` (feel free to use a different identification middleware):
```php
'middleware' => [
'public' => ['web', 'universal', InitializeTenancyByDomain::class], // Don't forget to import the middleware
'private' => ['web', 'platform', 'universal', 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'));
});
```
- Add 'platform' middleware to your tenant routes (`routes\tenant.php`):
```php
Route::middleware([
'web',
'platform',
InitializeTenancyByDomain::class,
PreventAccessFromCentralDomains::class,
]);
```