Enhancing Route Generation with Query Parameters #52703
Unanswered
Jagadish056
asked this question in
Ideas
Replies: 1 comment
-
I like the overall idea, but the naming doesn't quite cut it for me as it doesn't mirror your intent clearly and unambiguously. Maybe, the problem is that the method always returns a string. If it instead returned a stringable class instance (which would still work the same in blade then), additional calls to methods of said class could be chained until the route is constructed:
(of course, this is just an example and not intended to be a real implementation) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
While editing a row, generating URLs with query parameters is a common task, particularly when dealing with pagination, sorting, and filtering. However, manually appending query parameters to routes can make the code cumbersome. For example:
To improve code readability and streamline this process, I suggest implementing a feature that automatically appends the current query parameters to the generated URL.
Proposed Solution:
One possible approach is to extend the
route()
helper to optionally include existing query parameters. If modifyingroute()
isn’t feasible, we could introduce a new helper function,routeWithQuery()
, to handle this.Here’s a potential implementation:
With this helper, the code can be simplified to:
Beta Was this translation helpful? Give feedback.
All reactions