Skip to content

Instantly share code, notes, and snippets.

View zeetabit's full-sized avatar
🏠
remote SSE PHP

Serhii Doroshenkov zeetabit

🏠
remote SSE PHP
View GitHub Profile
@claytonrcarter
claytonrcarter / README.md
Last active June 8, 2023 05:42
Share named routes between Laravel and Javascript

Share named routes between Laravel and Javascript

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.

Installation

1. Install RouteJson.php

Copy RouteJson.php into your app as app/Console/Commands/RouteJson.php