Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

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.



This post first appeared on Neutron Dev, please read the originial post: here

Share the post

Check If Route Exists in Laravel

×

Subscribe to Neutron Dev

Get updates delivered right to your inbox!

Thank you for your subscription

×