BookCourseValidate.php 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace app\admin\validate\life;
  3. use think\Validate;
  4. class BookCourseValidate extends Validate
  5. {
  6. protected $rule = [
  7. 'course_name' => 'require|max:20',
  8. 'course_id' => 'require',
  9. 'course_time' => 'require',
  10. 'course_book_id' => 'require',
  11. 'course_price' => 'require',
  12. 'course_status' => 'require',
  13. ];
  14. protected $message = [
  15. 'course_id.require' => '课程目录ID不能为空',
  16. 'course_name.require' => '课程目录名称不能为空',
  17. 'course_time.require' => '上课时间不能为空',
  18. 'course_name.max' => '课程目录名称不能超过20字',
  19. 'course_book_id.require' => '所属课程id不能为空',
  20. 'course_price.require' => '课程目录价格不能为空',
  21. 'course_status.require' => '课程目录状态不能为空',
  22. ];
  23. //场景
  24. protected $scene = [
  25. 'create' => ['course_name','course_time','course_book_id','course_price','course_status'],
  26. 'update' => ['course_id','course_name','course_time','course_book_id','course_price','course_status'],
  27. 'info' => ['course_id']
  28. ];
  29. }