Check If Route Exists in Laravel

Let’s look at how we can check if a route exists in a Laravel project.


We’re going to use the has() method from the Route facade.

Note that it tries to find the route by name.

If your API route doesn’t have a name it won’t be able to find it.

We can use the same logic in the Blade templates as well.


Happy coding 😊

Let me know what you think about this article through comments below, or on Twitter at @pelu_carol.

If you find this article helpful, please share it with others and subscribe to the blog to support me, and receive a bi-monthly-ish e-mail notification on my latest articles.


You may also like...