Laravel 5.7, Vue.js and zizaco/entrust

Posted 5 months ago by valeraefimov696

Hello. I try to use entrust in my project. But I don’t know how to properly use entrust and Vue.js so that it would be as safe as in Views.

@role ('admin')
    <p> This is visible. </ p>

I tried to transfer all the permissions to my component.

 $ permissions = User :: getAllPermissions ();


<v-btn dark color = "indigo" @ click = "openDialogCreate" v-if = "$ root.hasPermissions (['add_post'])" ">
                                To add
                                <v-icon dark> add </ v-icon>
                            </ v-btn>
methods: {
        hasPermissions (data) {
            var vm = this;
            var check = false;
            if (Object.keys (this.getMe) .length> 0) {
       (function (value, key) {
                    if (vm.getMe.permissions.includes (value)) {
                        check = true;
                return check;


but it seems to me a bad decision.

Please sign in or create an account to participate in this conversation.