laravel-responder
laravel-responder copied to clipboard
How do I customize error code when using responder()->error()->respond?
Hey dude, great package. Would love to customize the error code when doing:
responder()->error('email_taken', 'The email is already taken')->respond();
so it doesn't always return error=500 by default. Also, not ideal to create an exception.
{"status":500,"success":false,"error":{"code":"email_taken","message":"The email is already taken"}}
Surely there is a simpler way. Any tips?
you can specify the error code like ->respond(400)