Install Ziggy into your Laravel
composer require tightenco/ziggy
Generate resources/js/ziggy.js by
php artisan ziggy:generate
Update
webpack.mix.js
fileconst path = require('path')mix.webpackConfig({ resolve: { alias: { ziggy: path.resolve('vendor/tightenco/ziggy/dist'), }, },});
Update
resources/js/app.js
fileimport route from 'ziggy'import { ZiggyVue } from './ziggy'# add mixin as followscreateInertiaApp({ resolve: name => require(`./Pages/${name}`), setup({ el, App, props, plugin }) { createApp({ render: () => h(App, props) }) .use(plugin) .mixin({ methods: { route } }) // add it .component('Link', Link) .mount(el) },})
Add the @routes Blade directive to your main layout, in my case, it was
resources/views/app.blade.php
, add in the header section.<head> ... @routes</head>
↧
Answer by zarpio for getting _ctx.route is not a function
↧