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

omrdev's avatar

Laravel Permissions - Authorize API routes

Hi guys,

I'm implementing roles and permissions to a platform, using Spatie Laravel Permissions and Laravel Policies, my question is:

  • How to implement authorization to routes that return JSON, so that when I send a request via ajax and the user is not allowed to access the resource a JSON response that states "unauthorized action" is returned?
0 likes
1 reply

Please or to participate in this conversation.