DEV Community

StuartCreed
StuartCreed

Posted on

Automatically pass your Laravel named routes to your JS with Ziggy

https://packagist.org/packages/tightenco/ziggy

I found this Ziggy package in the InertiaJS (https://inertiajs.com/ https://laracasts.com/series/learn-inertia-with-jeffrey) PingCRM example:
https://demo.inertiajs.com/login

image

This automatically passes through any named routes that you have to your JS. You can then access them in the same way as your would in your blade files, but instead in your JS:

image

A good article on InertiaJS:
https://blog.logrocket.com/introduction-to-inertia-js/

Top comments (0)