@role('writer')
I am a writer!
@else
I am not a writer...
@endrole
How can I use the above functionality in my vue file.
You can auth()->user()->getRoleNames() to get a collection of role names that can be passed into your Vue component.
For example in your blade view:
<vue-component :user-roles="{{ json_encode(auth()->user()->getRoleNames()) }}"></vue-component>
In your component you can then simple check if a certain role is in that array with
<div v-if="userRoles.includes('writer')">
I'm a writer.
</div>
<div v-else>
Not a writer.
</div>
Hopefully this is what you're looking for?