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)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay