CaptchaService.php 616 B

1234567891011121314151617181920212223
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: sdf_sky
  5. * Date: 2018/5/8
  6. * Time: 下午4:23
  7. */
  8. namespace App\Services;
  9. class CaptchaService
  10. {
  11. public function setValidateRules($type, &$validateRules){
  12. /*目前极验验证只对于用户登陆、注册、提问、发布文章开放*/
  13. if( in_array($type, ['code_login','code_register','code_create_question','code_create_answer','code_create_article']) && config('services.geetest_open')){
  14. $validateRules['geetest_challenge'] = 'geetest';
  15. } else {
  16. $validateRules['captcha'] = 'required|captcha';
  17. }
  18. }
  19. }