FieldExample.php 685 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php declare(strict_types=1);
  2. /**
  3. * Created by PhpStorm.
  4. * User: inhere
  5. * Date: 2019-01-10
  6. * Time: 23:59
  7. */
  8. namespace Inhere\ValidateTest\Example;
  9. use Inhere\Validate\FieldValidation;
  10. /**
  11. * Class FieldExample
  12. *
  13. * @package Inhere\ValidateTest\Example
  14. */
  15. class FieldExample extends FieldValidation
  16. {
  17. public function rules(): array
  18. {
  19. return [
  20. ['user', 'required|string:1,12'],
  21. ['pwd', 'required|string:6,16'],
  22. ['code', 'lengthEq:4'],
  23. ];
  24. }
  25. public function scenarios(): array
  26. {
  27. return [
  28. 'create' => ['user', 'pwd', 'code'],
  29. 'update' => ['user', 'pwd'],
  30. ];
  31. }
  32. }