Used ruote Ziggy file globaly #769
-
Hello! I'm in need of help. I don't want to use the @route expression in the blade and I want to load it globally from a generated js as it is in index.js. Is there a way to solve it if the generated file is synchronized globally? rather, it shouldn't be used in as many trees as I use it.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I don't completely understand your screenshots but you don't need two separate routers, just two Ziggy configs. It looks like you've figured that part out, but if not there's a // website
import { createApp } from 'vue';
import { ZiggyVue } from 'ziggy-js';
import { Ziggy } from './ziggy-website.js'; // import website routes
import App from './App.vue';
createApp(App).use(ZiggyVue, Ziggy); // admin
import { createApp } from 'vue';
import { ZiggyVue } from 'ziggy-js';
import { Ziggy } from './ziggy-admin.js'; // import admin routes
import App from './App.vue';
createApp(App).use(ZiggyVue, Ziggy); |
Beta Was this translation helpful? Give feedback.
I don't completely understand your screenshots but you don't need two separate routers, just two Ziggy configs. It looks like you've figured that part out, but if not there's a
--group
option you can pass to the artisan command to create separate files with separate route groups. Then everything in your first two screenshots is unnecessary—if you're using the Vue plugin, just pass it your admin config when you install it on the admin pages: