TopicValidator.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace App\Repositories\Validators\Exam;
  3. use \Prettus\Validator\Contracts\ValidatorInterface;
  4. use \Prettus\Validator\LaravelValidator;
  5. /**
  6. * Class TopicValidator.
  7. *
  8. * @package namespace App\Repositories\Validators\Exam;
  9. */
  10. class TopicValidator extends LaravelValidator
  11. {
  12. /**
  13. * Validation Rules
  14. *
  15. * @var array
  16. */
  17. protected $rules = [
  18. ValidatorInterface::RULE_CREATE => [
  19. 'name' => 'required',
  20. 'type' => 'required|integer',
  21. 'level' => 'nullable|sometimes|integer',
  22. 'point' => 'nullable|sometimes|integer',
  23. 'body' => 'nullable',
  24. 'result' => 'nullable',
  25. 'analysis' => 'nullable',
  26. 'status' => 'nullable',
  27. ],
  28. ValidatorInterface::RULE_UPDATE => [
  29. 'name' => 'required',
  30. 'type' => 'required|integer',
  31. 'point' => 'nullable|sometimes|integer',
  32. 'level' => 'nullable|sometimes|integer',
  33. 'body' => 'nullable',
  34. 'result' => 'nullable',
  35. 'is_open' => 'nullable',
  36. 'analysis' => 'nullable',
  37. 'status' => 'nullable',
  38. ],
  39. ];
  40. }