[ASK : Multitenant with Multidatabase Auth Problem]
fyi:
i'm using redis as session management and with basic setting like this :
'default' => [
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
],
here's the step i created a new account with new sub domain and let's say my main domain is "example.com" :
here's the real problem is : whenever i'm authenticating that new user in new subdomain -> "cool.example.com", the query match the user but instead it login as the first record inside main table.
table user main record 1 : admin table user cool.example.com : cool
in short, i'm login inside cool.example.com with username "cool" instead it's login as "admin" record.
what's the mistake here that i made ? oh yeah one more thing, i created a middleware to check current domain, if match then i add inside config with new database.connection and then use that connection to do every query
doh, it turns out i just need to move my custom middleware for tenant to the top
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community