php - Trying to set up a multi-tenancy with Request data identification on Laravel 9.3
I'm trying to set op a multi-tenancy with request data identification on Laravel, but I can't find anything about it.
Is it just so simple to follow this quikstart https://tenancyforlaravel.com/docs/v3/quickstart
And then follow this step?
https://tenancyforlaravel.com/docs/v3/tenant-identification/#Request-data-identification:~:text=public%20static%20property).-,Request%20data%20identification,-You%20might%20want
So change my tent route from this
<?php
declare(strict_types=1);
use Illuminate\Support\Facades\Route;
use Stancl\Tenancy\Middleware\InitializeTenancyByDomain;
use Stancl\Tenancy\Middleware\PreventAccessFromCentralDomains;
/*
|
To this:
{-code-2}
Answer
Answer
Answer
Answer
Answer
Answer
Answer
----
| Tenant Routes
|
Answer
Answer
Answer
Answer
Answer
Answer
Answer
----
|
| Here you can register the tenant routes for your application.
| These routes are loaded by the TenantRouteServiceProvider.
|
| Feel free to customize them however you want. Good luck!
|
*/
Route::middleware([
'web',
InitializeTenancyByDomain::class,
PreventAccessFromCentralDomains::class,
])->group(function () {
Route::get('/', function () {
return 'This is your multi-tenant application. The id of the current tenant is ' . tenant('id');
});
});|||<?php
declare(strict_types=1);
use Illuminate\Support\Facades\Route;
use Stancl\Tenancy\Middleware\InitializeTenancyByRequestData;
use Stancl\Tenancy\Middleware\PreventAccessFromCentralDomains;
/*
|
Answer
Answer
Answer
Answer
Answer
Answer
Answer
----
| Tenant Routes
|
Answer
Answer
Answer
Answer
Answer
Answer
Answer
----
|
| Here you can register the tenant routes for your application.
| These routes are loaded by the TenantRouteServiceProvider.
|
| Feel free to customize them however you want. Good luck!
|
*/
Route::middleware([
'web',
InitializeTenancyByRequestData::class,
PreventAccessFromCentralDomains::class,
])->group(function () {
Route::get('/', function () {
return 'This is your multi-tenant application. The id of the current tenant is ' . tenant('id');
});
});
Source