mirror of
https://github.com/stancl/tenancy-docs.git
synced 2025-12-12 18:24:03 +00:00
add the path to the "home" route for central application
This commit is contained in:
parent
2c0a9cd53a
commit
acec90c269
1 changed files with 14 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ section: content
|
||||||
---
|
---
|
||||||
|
|
||||||
# Laravel Orchid {#laravel-orchid}
|
# 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.
|
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
|
## Both in the central app and the tenant app
|
||||||
|
|
@ -13,13 +14,16 @@ Laravel Orchid has already been installed according to the [documentation Orchid
|
||||||
|
|
||||||
- To use Orchid both in the central & tenant parts you need to enable [Universal Routes](docs/v3/features/universal-routes).
|
- 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`
|
- Add the tenancy middleware to your `config\platform.php`
|
||||||
|
|
||||||
```php
|
```php
|
||||||
'middleware' => [
|
'middleware' => [
|
||||||
'public' => ['web', 'universal', \Stancl\Tenancy\Middleware\InitializeTenancyByDomain::class],
|
'public' => ['web', 'universal', \Stancl\Tenancy\Middleware\InitializeTenancyByDomain::class],
|
||||||
'private' => ['web', 'platform', 'universal', \Stancl\Tenancy\Middleware\InitializeTenancyByDomain::class],
|
'private' => ['web', 'platform', 'universal', \Stancl\Tenancy\Middleware\InitializeTenancyByDomain::class],
|
||||||
],
|
],
|
||||||
```
|
```
|
||||||
|
|
||||||
- Add a route to `routes\platform.php`
|
- Add a route to `routes\platform.php`
|
||||||
|
|
||||||
```php
|
```php
|
||||||
Route::screen('/', PlatformScreen::class)
|
Route::screen('/', PlatformScreen::class)
|
||||||
->name('platform.index')
|
->name('platform.index')
|
||||||
|
|
@ -27,14 +31,22 @@ Laravel Orchid has already been installed according to the [documentation Orchid
|
||||||
return $trail->push(__('Home'), route('platform.index'));
|
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'`
|
||||||
|
|
||||||
|
```php
|
||||||
|
public const HOME = 'admin/main';
|
||||||
|
```
|
||||||
|
|
||||||
- Tenant Routes `routes\tenant.php`
|
- Tenant Routes `routes\tenant.php`
|
||||||
|
|
||||||
```php
|
```php
|
||||||
Route::middleware([
|
Route::middleware([
|
||||||
'web',
|
'web',
|
||||||
'platform',
|
'platform',
|
||||||
InitializeTenancyByDomain::class,
|
InitializeTenancyByDomain::class,
|
||||||
PreventAccessFromCentralDomains::class,
|
PreventAccessFromCentralDomains::class,
|
||||||
])->prefix('admin')->group(function () {
|
])->prefix(Orchid\Platform\Dashboard::prefix('/'))->group(function () {
|
||||||
Route::get('/', function () {
|
Route::get('/', function () {
|
||||||
return 'This is your multi-tenant application. The id of the current tenant is ' . tenant('id');
|
return 'This is your multi-tenant application. The id of the current tenant is ' . tenant('id');
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue