Quantcast
Channel: User zarpio - Stack Overflow
Viewing all articles
Browse latest Browse all 39

Answer by zarpio for getting _ctx.route is not a function

$
0
0
  1. Install Ziggy into your Laravel

    composer require tightenco/ziggy

  2. Generate resources/js/ziggy.js by

    php artisan ziggy:generate

  3. Update webpack.mix.js file

    const path = require('path')mix.webpackConfig({    resolve: {        alias: {            ziggy: path.resolve('vendor/tightenco/ziggy/dist'),        },    },});
  4. Update resources/js/app.js file

    import 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)  },})
  5. 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>

Viewing all articles
Browse latest Browse all 39

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>