简体   繁体   中英

how to use cartalyst sentinel permission check in laravel vue spa?

I am building a SPA with laravel and Vue js. For authentication, I have used cartalyst/sentinel package. I am facing a problem to implement permission check in frontend. In the backend I have checked for the permission with Sentinel::hasAccess() function. But in the frontend, I don't have any idea how can I check for permission. As I am using Vue SPA but they don't provide any helper function for SPA frontend.

You could return an array with all the permissions and save it in your vue state and then to verify a permission you could do the following:

<button v-if="permisions['user.delete']" >delete user</button>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM