| 1 | <?php |
||
| 15 | class CaptchaValidate |
||
| 16 | { |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var Captcha |
||
| 20 | */ |
||
| 21 | protected $captcha; |
||
| 22 | |||
| 23 | |||
| 24 | public function __construct(Captcha $captcha) |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @param Request $request |
||
| 31 | * @param Closure $next |
||
| 32 | * @return mixed |
||
| 33 | */ |
||
| 34 | public function handle(Request $request, Closure $next) |
||
| 46 | |||
| 47 | /** |
||
| 48 | * 抛出验证码错误的异常 |
||
| 49 | * |
||
| 50 | * @throws InvalidCaptcha |
||
| 51 | */ |
||
| 52 | protected function throwInvalidException() |
||
| 57 | |||
| 58 | /** |
||
| 59 | * 验证 |
||
| 60 | * |
||
| 61 | * @param string $input |
||
| 62 | * @return bool |
||
| 63 | */ |
||
| 64 | protected function check($input) |
||
| 68 | |||
| 69 | /** |
||
| 70 | * 返回用户输入的验证码 |
||
| 71 | * |
||
| 72 | * @param Request $request |
||
| 73 | * @return string |
||
| 74 | */ |
||
| 75 | protected function getCaptcha(Request $request) |
||
| 79 | } |