Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

johnDoe220's avatar

how to get all query string and implement in eloquent?

i will fetch users by multiple queryString. Think that's exactly what I want.

localhost:8000/consultation/gynecologist-infertility?cb_hasFastPhoneCall=true&cb_hasPhoneCall=true&cb_hasVideoCall=true&cb_hasChat=true&justFemaleR=true&justMaleR=true

Assuming all this data is in the users table, how can I do this? My question is as follows: 1- How to get all query strings. 2- How to apply in eloquent. Because the number of query strings is unclear, I don't know what to do

0 likes
5 replies
johnDoe220's avatar

@vincent15000 No this is not the solution, I want to insert unlimited number of query strings with unspecified number in sql

1 like
vincent15000's avatar

@johnDoe220 I specify that you can't have an unlimited number of query strings, there is only one unique query string, but the query string can contain an unlimited number of parameters.

What do you mean by saying "unspecified number" ? You mean that you don't know in advance the number of parameters ?

I don't understand why you are saying that parse_url() is not a solution.

vincent15000's avatar

@johnDoe220 I don't see any filter on this site.

parse_url allow you to parse a URL and separate the domain part from the query string part.

Then you have to separate all parameters inside the query string. You know that each parameter and its value are separated by &. You can split the string using this separator. And you will obtain an array with all parameters, no matter the number of them.

  • parse the URL to retrieve the query string

  • explode the query string to an array

Please or to participate in this conversation.