Skip to content

Commit 5f8c7de

Browse files
committed
formatting
1 parent 9b65240 commit 5f8c7de

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Illuminate/Database/DatabaseManager.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,19 +246,21 @@ public function reconnect($name = null)
246246
}
247247

248248
/**
249-
* Set the database connection for the callback execution.
249+
* Set the default database connection for the callback execution.
250250
*
251251
* @param string $name
252252
* @param callable $callback
253-
* @return void
253+
* @return mixed
254254
*/
255255
public function usingConnection(string $name, callable $callback)
256256
{
257257
$previousName = $this->getDefaultConnection();
258258

259259
$this->setDefaultConnection($name);
260-
$callback();
261-
$this->setDefaultConnection($previousName);
260+
261+
return tap($callback(), function () use ($previousName) {
262+
$this->setDefaultConnection($previousName);
263+
});
262264
}
263265

264266
/**

0 commit comments

Comments
 (0)