This is a 2-part technique to share named routes between Laravel and Javascript. It uses a custom artisan
command to export your named routes to JSON, and a Javascript route()
helper to lookup the route and fill in any parameters. Written for Laravel 5.3; not tested in 5.4.
Copy RouteJson.php
into your app as app/Console/Commands/RouteJson.php