AdminControllerValidate.php 597 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App\Http\Validate;
  3. use Illuminate\Support\Facades\Validator;
  4. class AdminControllerValidate extends BaseValidate
  5. {
  6. /**
  7. * 后台用户登录验证
  8. * @param $data
  9. */
  10. public function login($data)
  11. {
  12. $validate = Validator::make($data,
  13. [
  14. "adminAccount"=>"required",
  15. "adminPassword"=>"required",
  16. ]
  17. );
  18. if($validate->fails()){
  19. //验证错误
  20. $this->setError($validate->errors()->first());
  21. return false;
  22. }
  23. return true;
  24. }
  25. }