-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
Data from JSON column returned quoted when used with mysql #25726
Comments
The ->select(['level0->>level1->>string1 as name']) |
Yes, this works for MySql. |
You want to use the same code with different databases? You'll have to use something like |
I thought about it but isn't the point of using orm so I don't have to? |
The MySQL implementation behaves differently for historical reasons. I agree that this is not ideal. I'll look into a PR. |
Ok, thank you. |
Will be fixed in Laravel 5.8. |
Please close the issue. |
Description:
When selecting data from a JSON column and using MySQL data is returned quoted.
If database driver is changed to Postgres then it's ok.
Mysql docs suggests using ->> operator but that doesn't work with eloquent.
Steps To Reproduce:
MyModel::where( 'level0->level1->myString', 'like', '%'.strtoupper($searchTerm).'%' ) ->select([ 'level0->level1->string1 as name', ]) ->get() ->toArray();
The text was updated successfully, but these errors were encountered: