for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Flugg\Responder\Traits;
use Illuminate\Contracts\Validation\Validator;
use Flugg\Responder\Exceptions\UnauthorizedException;
use Flugg\Responder\Exceptions\ValidationFailedException;
/**
* Use this trait in your base form request to override the exceptions thrown when
* validation or authorization fails. This allows the package to render proper
* API responses through the HandlesApiErrors trait.
*
* @package Laravel Responder
* @author Alexander Tømmerås <[email protected]>
* @license The MIT License
*/
trait ThrowsApiErrors
{
* Handle a failed validation attempt.
* @param \Illuminate\Contracts\Validation\Validator $validator
* @return void
* @throws ValidationFailedException
protected function failedValidation( Validator $validator )
throw new ValidationFailedException( $validator );
}
* Handle a failed authorization attempt.
* @throws UnauthorizedException
protected function failedAuthorization()
throw new UnauthorizedException();