79287179

Date: 2024-12-17 08:44:26
Score: 1.5
Natty:
Report link

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
Reasons:
  • Blacklisted phrase (2): still not working
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Developer Nilesh