-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
EloquentUserProvider RetrieveById & RetrieveByToken - Ambiguous ID #43274
Comments
BenWalters
added a commit
to BenWalters/framework
that referenced
this issue
Jul 19, 2022
Let's see how your PR goes 👍 |
BenWalters
added a commit
to BenWalters/framework
that referenced
this issue
Jul 19, 2022
taylorotwell
pushed a commit
that referenced
this issue
Jul 19, 2022
* [8.x] Protect against ambiguous columns Resolving #43274 * Updating tests.
taylorotwell
pushed a commit
to illuminate/auth
that referenced
this issue
Jul 19, 2022
* [8.x] Protect against ambiguous columns Resolving laravel/framework#43274 * Updating tests.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description:
SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'id' in where clause is ambiguous
Caused by Illuminate\Auth\EloquentUserProvider:52 (retrieveById)
When applying a global scope to our Users model that also has an ID field, the above mentioned function is not qualifying the field name (adding the table prefix), thus causing the "'id' in where clause is ambiguous" error.
Seemingly the same issue was raised here - laravel/ideas#1956
I believe that wrapping
$model->getAuthIdentifierName()
in$model->qualifyColumn()
would resolve the issue and should be implemented in both theretrieveById
andretrieveByToken
functions of EloquentUserProvider.The text was updated successfully, but these errors were encountered: