Skip to content

Commit

Permalink
add Laravel Orchid integration (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
Impeck authored Apr 9, 2022
1 parent 887bc9e commit a368078
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
3 changes: 2 additions & 1 deletion navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
'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',
Expand Down Expand Up @@ -205,6 +205,7 @@
'Nova' => 'integrations/nova',
'Telescope' => 'integrations/telescope',
'Livewire' => 'integrations/livewire',
'Orchid' => 'integrations/orchid',
],
],
'Console commands' => 'console-commands',
Expand Down
42 changes: 42 additions & 0 deletions source/docs/v3/integrations/orchid.blade.md
Original file line number Diff line number Diff line change
@@ -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');
});
});
```

0 comments on commit a368078

Please sign in to comment.