-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Consider if the route()
helper should throw if the route does not exist
#1731
Comments
This is simple enough to fix by using getOrFail in the function, wondering if we should take more steps to normalize the API, and match to Laravel. I'm not sure if there is ever really a reason to want a null return here, I think if you don't want to catch an exception, it's better to use Routes::exists to check first. See #591 which was closed due to similar motivations |
caendesilva
added a commit
that referenced
this issue
Jun 28, 2024
Fixed in #1741 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Right now, the
route()
helper returns null if the route does not exist. This means it can a typo in a Blade file like{{ route('hoem') }}
will silently link to the same page (href=""
). The DX could then be improved by throwing a helpful exception like in Laravel.There have been some discussion on this before, IIRC, and we may want this in v2 paired with a deprecation warning for legacy uses.
The text was updated successfully, but these errors were encountered: