I'm trying to find a clean way to override the AuthorizationException to take a dynamic string that can be passed back when a policy fails.
Things I know I can do are:
1) Wrap the policy in the controller with a try-catch, then rethrow a custom exception that takes a specific string, which seems a bit verbose 2) abort(403, '...')
in the policy prior to returning, which seems a hacky since policies are already doing the work
and then in /Exceptions/Handler::render I can send back the response as JSON
Is there a nicer way to do this to get a message in the response of a policy failure?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2g2DjrX
via IFTTT
Aucun commentaire:
Enregistrer un commentaire