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

Adding double quotes into parameters when using with Eloquent LIKE operator. #293

Closed
souravdutt opened this issue Sep 28, 2023 · 3 comments

Comments

@souravdutt
Copy link
Contributor

Description
I found that API request adding sent through Request-docs interface is adding double quotes into parameters when using with eloquent LIKE operator. For example if I am sending GET request with parameter &search=test and if I use it in eloquent
$model->where('column', 'like', "%{$req->search}%")
I get zero result, and lookinto query output I found that above eloquent is used like:
WHERE column LIKE '%\"test\"%'
But when I send the same request through Postman it works fine.

Expected behavior
the query out must be as given below:
WHERE column LIKE '%test%'

Screenshots
image
image

@kevincobain2000
Copy link
Member

kevincobain2000 commented Sep 28, 2023

Interesting, try once with APP_DEBUG=false in your env file. Seems like the middleware that records sql is causing this.
If that doesn't work, then probably on the frontend, it is adding sanitization.

@souravdutt
Copy link
Contributor Author

My bad... I was passing the values incorrectly..
The correct way to pass is &search=test (i.e. without quotes) not &search="test"
I can't believe I didn't realize that earlier!

Thanks for your response @kevincobain2000
And once again, I'm sorry for the oversight.

@kevincobain2000
Copy link
Member

No worries.

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

No branches or pull requests

2 participants