Database connection [tenant] not configured

What seems to be the problem:
I’m using tenancyforlaravel (with multiple database).
Fetching of data doesn’t have any problem. Loading it via livewire components does work.
But whenever I add the
wire:click=""
I noticed that on the tenant side, it uses a “tenant” connection instead of “central”

Steps to Reproduce:
Basic setup of tenancyforlaravel
added the basic “counter” functionality" on docs (just for a test)

Are you using the latest version of Livewire: yes

Do you have any screenshots or code examples:


https://forum.laravel-livewire.com/uploads/default/original/2X/6/6b2d0cb1822729a939b015ed541d5aa34989ddb4.png

Hey there. Actually I’m working in a SaaS project with Tenancy packages and the frontend framework Livewire and all is working fine. You have to be sure of configure all the lifecycle hook for tenancy, the tenant connections listener, tenant identification, etc. For me not was an easy configuration and the tenancy documentation is not so understandable, but once you granted that all works well. Greetings

I don’t get it. sorry,

this is my current setup.


then on the admin side. I added an optional tenancy_db_name, username and password.

It does load the product when I go to the tenant subdomain
but whenever I click on the wire:click event. I can see that the “connection” used was changed to “tenant” instead of I think null?

I think this is related to

Database tenancy bootstrapper

The database tenancy bootstrapper switches the default database connection to tenant after it constructs the connection for that tenant.

and also here

Specifying template connections

To specify the connection that should be used to construct this tenant’s database connection (the array like you’d find in config/database.php , set the tenancy_db_connection key. Otherwise, the connection whose name is in the tenancy.database.template_connection config will be used. If that key is null, the central connection will be used.

but not really sure how can I specify it.

I didn’t add any new set of connections on my database.php… is it necessary to add one?

I don’t know anything about this bootstrapper, the simplest thing of tenancy is define the model’s tenant and the packages works arround…once you set up all the package. I don’t have any multiples connection defined, I don’t have anything in config/database for tenancy…I mean, obviously I deploy tenancy in other way (there is no one) but the things is that there isn’t any matter using Livewire. I followed a quickly course for it, because really, I don’t understand the documentation. If you want, a can describe you the steps (as long as my mind and my notes can) that I follow for configure the package. There is other place through Discord that you can get some help from the contributors and community

Thanks!

I would really appreciate it. I just followed it also, not sure where I was having an error with.

and yeah, true, the documentation for me is quite confusing.

@prospero
All good now, it was really a misconfiguration of my tenancy. I missed the universal / livewire setup. i’m so dumb. lol

1 Like