1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace app\admin\validate\life;
- use think\Validate;
- class BookValidate extends Validate
- {
- protected $rule = [
- 'life_book_name' => 'require|max:20',
- 'life_book_id' => 'require',
- 'life_book_title' => 'require',
- 'life_book_time' => 'require',
- 'life_book_category_id' => 'require',
- 'life_book_teacher_id' => 'require',
- 'life_book_num' => 'require',
- 'life_book_img' => 'require',
- 'life_book_status' => 'require',
- 'life_book_type' => 'require',
- ];
- protected $message = [
- 'life_book_id.require' => '课程ID不能为空',
- 'life_book_name.require' => '课程名称不能为空',
- 'life_book_title.require'=> '课程简介不能为空',
- 'life_book_time.require' => '课程时间不能为空',
- 'life_book_name.max' => '课程名称不能超过20字',
- 'life_book_category_id.require' => '课程分类不能为空',
- 'life_book_teacher_id.require' => '课程教师不能为空',
- 'life_book_num.require' => '上课人数不能为空',
- 'life_book_img.require' => '课程图片不能为空',
- 'life_book_status.require' => '课程状态不能为空',
- 'life_book_type.require' => '课程类型不能为空',
- ];
- //场景
- protected $scene = [
- 'create' => ['life_book_name','life_book_title','life_book_time','life_book_category_id','life_book_teacher_id','life_book_num','life_book_type','life_book_status','life_book_img'],
- 'update' => ['life_book_id','life_book_name','life_book_title','life_book_time','life_book_category_id','life_book_teacher_id','life_book_num','life_book_type','life_book_status','life_book_img'],
- 'info' => ['life_book_id']
- ];
- }
|