Please check in your setup
Use Middleware in routes:
// routes/tenant.php
Route::middleware([
'web',
InitializeTenancyByDomain::class,
PreventAccessFromCentralDomains::class,
])->group(function () {
// Your routes here
});
Fix for AppServiceProvider:
public function boot()
{
if (tenancy()->initialized) {
$tenant = tenant();
// you can access tenant('id')
}
}
If still not working then clear the config and cache:
php artisan config:clear
php artisan cache:clear