UserValidator.php 755 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /*
  3. * This file is part of the Jiannei/lumen-api-starter.
  4. *
  5. * (c) Jiannei <longjian.huang@foxmail.com>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. namespace App\Repositories\Validators;
  11. use Prettus\Validator\Contracts\ValidatorInterface;
  12. use Prettus\Validator\LaravelValidator;
  13. class UserValidator extends LaravelValidator
  14. {
  15. protected $rules = [
  16. ValidatorInterface::RULE_CREATE => [
  17. 'name' => 'required|string|max:100',
  18. 'email' => 'required|email|unique:users,email',
  19. 'password' => 'required|min:8',
  20. ],
  21. ValidatorInterface::RULE_UPDATE => [
  22. 'password' => 'required|min:8',
  23. ],
  24. ];
  25. }