<script> import { usePage } from '@inertiajs/inertia-vue3' export default { created() { const roles = usePage().props.value.auth.roles; const permissions = usePage().props.value.auth.permisos; this.$gates.setRoles(roles); this.$gates.setPermissions(permissions); this.soyAdmin(); }, methods: { soyAdmin(){ if(this.$gates.hasRole('admin')){ console.log("soy admin"); }else{ console.log("no soy admin"); } } } } </script>
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Discussion on: Roles y permisos en Laravel con Inertia.js
Replies for: Recién logro entenderte, no lo he utilizado como método como indica la documentación de Vue Gate, solo lo he utilizado como directiva. Pero recuerd...
For further actions, you may consider blocking this person and/or reporting abuse