codezero-be / laravel-localized-routes

⭐️ A convenient way to set up and use localized routes in a Laravel app.
MIT License
491 stars 45 forks source link

Prioritizing route parameter over query parameter #95

Closed juancamunozfp closed 1 year ago

juancamunozfp commented 1 year ago

We are encountering an issue that arises when a route has a route parameter and the URL query string also contains a parameter with the same name as the route parameter.

This modification ensures that the route parameter value takes precedence over the query parameter with the same name

ivanvermeyen commented 1 year ago

Hi,

Thank you for the PR!

I was able to produce the issue in a test, but your proposed solution would remove the query string parameter, which is probably also undesirable.

Instead, I have split the query string parameters from the route parameters and appended them manually.

See commit: https://github.com/codezero-be/laravel-localized-routes/commit/fac6e4a7bb32e2c42bb7aca53d3336d450ab3cba

I tagged this in release 3.1.3. Let me know if this fixes your issue. 👍

juancamunozfp commented 1 year ago

Hi,

Thank you for the PR!

I was able to produce the issue in a test, but your proposed solution would remove the query string parameter, which is probably also undesirable.

Instead, I have split the query string parameters from the route parameters and appended them manually.

See commit: fac6e4a

I tagged this in release 3.1.3. Let me know if this fixes your issue. +1

Thank you for your reply, yes, It works well!!

I prefer also your implementation, so I'll close the pr now that the issue has been solved.

Once again, thank you very much!