From f25fcd2061cd3c01be0cd74e5e72a4a15aaa0583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Hajdu?= <40004107+SajtiDH@users.noreply.github.com> Date: Thu, 28 Mar 2024 15:12:19 +0100 Subject: [PATCH] [11.x] Make DB::usingConnection() respect read/write type (#50806) * Resolving default connection name before parsing it * formatting --------- Co-authored-by: Taylor Otwell --- src/Illuminate/Database/DatabaseManager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Database/DatabaseManager.php b/src/Illuminate/Database/DatabaseManager.php index 9239fca06f90..cf408bc68785 100755 --- a/src/Illuminate/Database/DatabaseManager.php +++ b/src/Illuminate/Database/DatabaseManager.php @@ -81,9 +81,9 @@ public function __construct($app, ConnectionFactory $factory) */ public function connection($name = null) { - [$database, $type] = $this->parseConnectionName($name); + $name = $name ?: $this->getDefaultConnection(); - $name = $name ?: $database; + [$database, $type] = $this->parseConnectionName($name); // If we haven't created this connection, we'll create it based on the config // provided in the application. Once we've created the connections we will