Laravel-permission: use @can inside a vue component

Created on 23 Aug 2018  路  2Comments  路  Source: spatie/laravel-permission

How can i use blade directive @can inside a vue component to authorize a user?

@can('edit-post')
     <button><button>
@endcan
support

Most helpful comment

This package doesn't do anything specific to Vue.

The answer to your question is general to Laravel/Vue.
Here are some articles to consider for learning how to bring back-end server logic to the front-end:
https://pineco.de/implementing-laravels-authorization-front-end/
https://stackoverflow.com/questions/45868924/using-laravels-gate-authorization-in-vuejs
https://vuejsdevelopers.com/2018/01/08/vue-js-roles-permissions-casl/
https://vegibit.com/how-to-use-vuejs-with-laravel-blade/

All 2 comments

This package doesn't do anything specific to Vue.

The answer to your question is general to Laravel/Vue.
Here are some articles to consider for learning how to bring back-end server logic to the front-end:
https://pineco.de/implementing-laravels-authorization-front-end/
https://stackoverflow.com/questions/45868924/using-laravels-gate-authorization-in-vuejs
https://vuejsdevelopers.com/2018/01/08/vue-js-roles-permissions-casl/
https://vegibit.com/how-to-use-vuejs-with-laravel-blade/

Hey guys! We get many clicks from this issue (pineco.de), so it made us convert the article to a real package. Give it a shot if you wish: https://github.com/thepinecode/policy

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ergonomicus picture ergonomicus  路  3Comments

ionesculiviucristian picture ionesculiviucristian  路  4Comments

ghost picture ghost  路  3Comments

enghelewa picture enghelewa  路  4Comments

MichalKrakow picture MichalKrakow  路  4Comments