I was having a problem when checking whether a route was the current one. The method was always returning "undefined" when asking for current route or false when comparing with the route name. I looked a lot, I studied Ziggy's src, but nothing made sense. I discovered that this behavior occurs when we configure the same name for the same route. In my case, I mistakenly and unnecessarily put the same name for the patch method for the same URI.
I don't know if it would be worth putting a warning about this in the documentation or treating the code to get around this, but I believe it would be interesting to at least put a warning, as it is not a very clear problem of identifying what is wrong, and an alert would give guidance to the developer.I
Ziggy version
2.1.0
Laravel version
11.5.0
Description
I was having a problem when checking whether a route was the current one. The method was always returning "undefined" when asking for current route or false when comparing with the route name. I looked a lot, I studied Ziggy's src, but nothing made sense. I discovered that this behavior occurs when we configure the same name for the same route. In my case, I mistakenly and unnecessarily put the same name for the patch method for the same URI.
I don't know if it would be worth putting a warning about this in the documentation or treating the code to get around this, but I believe it would be interesting to at least put a warning, as it is not a very clear problem of identifying what is wrong, and an alert would give guidance to the developer.I
Ziggy call and context
Ziggy configuration
Route definition