Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] Add usingConnection method to DatabaseManager #32761

Merged
merged 1 commit into from
May 11, 2020
Merged

[7.x] Add usingConnection method to DatabaseManager #32761

merged 1 commit into from
May 11, 2020

Conversation

antonkomarev
Copy link
Contributor

@antonkomarev antonkomarev commented May 11, 2020

This PR adds usingConnection method to Illuminate\Database\DatabaseManager.

It is useful when you want to execute some actions in one connection and then switch back to the original connection.

// Some logic performed on tenant connection

$this->databaseManager->usingConnection('landlord', function () {
    // Some logic performed on landlord connection
});

// Some logic performed on tenant connection

@taylorotwell taylorotwell merged commit 9b65240 into laravel:7.x May 11, 2020
@antonkomarev antonkomarev deleted the add-using-connection-to-database-manager branch May 11, 2020 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants