Join 25,000+ Laravel Developers and join the free Laravel Newsletter
Laravel Packages / March 25, 2014

Access Laravel Routes from JavaScript

Wouldn’t it be amazing if we could access our Laravel routes from JavaScript?

Yes it would! I have been a pretty substantial app in Backbone and this would have been a nicety. Managing them yourself is not terrible but because typically in Backbone you define routes for both models and collections if you ever change a route it takes a few minutes of searching and replacing to get everything up to date.

Another useful pattern is when you have dynamic route groups. Wardrobe has this feature so end users can over-ride the admin path.

This would also make a great pairing with Jeff Way’s PHP Variables to JavaScript.

This appeared first on Laravel News

Visit Resource →

Laravel News Partners


Join the weekly newsletter and never miss out on new tips, tutorials, and more.