Open blpraveen opened 3 years ago
public static function connectMongo($userId = null)
{
//Modellerin içerisinde zaten connection tanımlı buradaki temel olay dbname değişikliği
if (\Illuminate\Support\Facades\Config::get('database.connections.mongodb.database') != 'user_id_' . $userId){
DB::purge('mongodb');
\Illuminate\Support\Facades\Config::set('database.connections.mongodb.database', 'user_id_' . $userId);
DB::reconnect('mongodb');
}
}
Description:
I tried to reconnect to different db connection and run migration it is still running migration with default connection
Steps to reproduce
Expected behaviour
It should connect to new connection and Run the migration files
Actual behaviour
It is running migration in the default connection