Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Sinres's avatar

How to generate slug to use in code for Roles and Permissions?

Hello Guy's!

I'm using packages spatie/laravel-permission and I don't know how I can generate slug to roles and permission for Laravel API? For Laravel blade we can use @can('write a posts) directives etc. but how use this by Laravel API ... I don't know how. Please explain it to me

0 likes
1 reply
psylogic's avatar

Well, as I understand if you want to use ACL in your Front-end you need to use another package for that too.

while you are protecting your API routes using middleware and policies (using your permissions)

Please or to participate in this conversation.