[Vuejs]-How to add permission control in laravel with vue project?

0👍

You can perform checks before going to a certain route via beforeEnter() in routeConfig. Sample is here:

const router = new VueRouter({
  routes: [
    {
      path: '/foo',
      component: Foo,
      beforeEnter: (to, from, next) => {
        // ... Do your checkings here
      }
    }
  ]
})

0👍

To simply permission detection logic you can use CASL – https://github.com/stalniy/casl

There are a lot of interesting stuff in documentation and articles on medium explaining how integrate with Vue and other popular frameworks!

Leave a comment