Closed bosz closed 3 months ago
Switch your default database connection to landlord
in your .env file.
Switch your default database connection to
landlord
in your .env file.
Thank you for this. I tried it id didn't work then your suggestion gave me an idea, I changed the default DB_CONNECTION to tenant, DB_CONNECTION=tenant
and I have bellow
# Default
DB_CONNECTION=tenant
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=
DB_USERNAME=abc
DB_PASSWORD=xxx
And it works, thank you so much for the spark. I appreciate.
I am using Laravel 11 and
"spatie/laravel-multitenancy": "^3.0",
I have followed all the configuration from the website but I have the error
SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected (Connection: mysql, SQL: select * from
sessionswhere
id= sHgCJGHEcH0rZhszNLf6NfZeCoFcjXeyVWrFYY1z limit 1)
Landlord migration
.env
config/database.php
config/multitenancy.php
my custom tenant model (app/Models/Tenant.php)
bootstrap/app
route/web.php
I have tried to log if its finding the right tenant and it shows that it does, but using the database from my landlord.tenants table is something that I don't get past.
Please, where could I be going wrong?