In VueJs or ReactJS if you want to use like route('posts.index'); then you need Ziggy
Dec 18, 2024
8
Level 12
Is it necessary to include Ziggy with the HandleInertiaRequests?
Hello,
I'm new to SSR with InertiaJs. I installed Breeze scaffolding with Inertia supporting SSR.
I found below lines in HandleInertiaRequests.php
'ziggy' => fn() => [
...(new Ziggy)->toArray(),
'location' => $request->url(),
],
and below code within the ssr.js
global.route = (name, params, absolute) =>
route(name, params, absolute, {
...page.props.ziggy,
location: new URL(page.props.ziggy.location),
});
Could someone please explain what is the use of this code? Is it safe to remove it? Because each request includes all the routes we declared in the Laravel.
Thanks
Please or to participate in this conversation.