Laravel 6 config()->get('database.connections.mysql') not matching DB:connection()

前端 未结 1 327
逝去的感伤
逝去的感伤 2021-01-23 07:27

Prerequisites

In my local environment I am working with multiple tenants and Redis (Auth required).
To serve the project I am using Valet.

For this case

1条回答
  •  粉色の甜心
    2021-01-23 07:50

    To dynamically change database name you should use:

    DB::disconnect(); 
    Config::set('database.mysql.database', 'tenant_foo'); 
    DB::reconnect();
    

    0 讨论(0)
提交回复
热议问题