I am stuck at my code i didnt know how to use hasPermissionTo in vue template to check if role has permission to do something.
<script setup>
import { Link } from "@inertiajs/inertia-vue3"
import { defineProps } from "vue";
const props = defineProps({
is_admin: Boolean,
role: Object,
});
</script>
Its Return this:
Now I want to check in in my nav link if role has permission to index that tab?
<Link class="flex items-center mt-4 py-2 px-6 bg-gray-700 bg-opacity-25 text-gray-100" :href="route('admin.index')" >
<svg class="h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M11 3.055A9.001 9.001 0 1020.945 13H11V3.055z" />
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M20.488 9H15V3.512A9.025 9.025 0 0120.488 9z" />
</svg>
<span class="mx-3">Dashboard</span>
</Link>
How to check with v-if for if role has permissions to show the dashboard link?
