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

[5.4] Set connection while creating a model #17392

Merged
merged 2 commits into from
Jan 18, 2017
Merged

[5.4] Set connection while creating a model #17392

merged 2 commits into from
Jan 18, 2017

Conversation

themsaid
Copy link
Member

@themsaid themsaid commented Jan 18, 2017

This PR adds the ability to set the desired connection to create the model on.

To save a model on a different connection you currently need to do something like:

$model = new User();

$model->setConnection('myConnection');

$model->save();

With this PR, by default we create the model on the default model connection, only if a connection is provided to the methods we'll use it to create our model.

@themsaid
Copy link
Member Author

@taylorotwell there's already a way to create models on a different connection as the above example, so feel free to close the PR if you think adding the connection argument adds some complexity to the code.

@taylorotwell taylorotwell merged commit 7ece167 into laravel:5.4 Jan 18, 2017
@taylorotwell
Copy link
Member

Thanks

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.

2 participants