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

[6.x] Use Model connection if set on Model when validating with exists:Model #31037

Merged

Conversation

alexkb
Copy link
Contributor

@alexkb alexkb commented Jan 6, 2020

This PR allows you to use the 'exists:App\Model' rule for validation even if it has a custom connection property set.

Prior to this PR, the only way to use a custom connection on a Model in the exists validation rule is to call the getConnectionName() on the model itself, which seems messy since we have to pass it for the table name anyway:
'exists:' . (new Model())->getConnectionName() . '.App\Model

@alexkb alexkb changed the title Use Model connection if set on Model when validating with exists:Model [6.x] Use Model connection if set on Model when validating with exists:Model Jan 6, 2020
@taylorotwell taylorotwell merged commit 69542b9 into laravel:6.x Jan 6, 2020
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