In your .env add
SESSION_DOMAIN = .your-domain.test
Make sure to clear the cache after doing that.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am implementing a multi-tenant Laravel application using archtechx/tenancy package. I have set up separate databases for each tenant and have created a Tenant model to manage tenants. I am using the central database to store information about tenants and their assigned modules.
I am facing two errors on my login page:
Here's what I have tried so far:
SESSION_DOMAIN value in my .env file to
.localhost:8000
SESSION_DRIVER to the database in my
config/session.php file.One more thing I try, I remove all the errors variable from register.balde file and submit the form then I receive them in my central database but when I get users from UserController they are using the right tenant Database.
here is my tenant.php
Auth::routes();
Route::middleware([
'web',
'auth',
InitializeTenancyByDomain::class,
PreventAccessFromCentralDomains::class,
CheckModuleMiddleware::class,
])->group(function () {
Route::get('/', function () {
// dd(\App\Models\User::all());
return 'This is your multi-tenant application. The id of the current tenant is ' . tenant('id');
});
Route::resource('users', App\Http\Controllers\UserController::class);
});
Despite these efforts, I am still facing the same errors. Can anyone suggest what could be causing these errors and how to fix them?
Please or to participate in this conversation.