| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- namespace App\Http\Requests\QuestionBank\QuestionBackend;
- use App\Http\Requests\BaseRequest;
- class QuestionRealTopic extends BaseRequest
- {
- /**
- * 获取应用于请求的规则
- *
- * @return array
- */
- public function rules()
- {
- // 返回结果
- return [
- 'title' => 'required',
- 'id' => 'required|integer|gt:0',
- 'question_count' => 'required|integer|gt:0',
- 'style' => 'required|integer|in:2,3,6',
- 'page' => 'integer|min:1',
- 'limit' => 'integer|min:1',
- //'chapter_id' => 'required|integer|gt:0',
- 'correct_answer' => 'required',
- 'explain' => 'required',
- 'is_high_freq' => 'required|integer|in:0,1',
- ];
- }
- // 场景列表
- protected $scenes = [
- 'list' => ['page', 'limit'],
- //'add' => ['title', 'style', 'chapter_id', 'correct_answer', 'explain', 'question_count'],
- 'edit' => ['id', 'title', 'style', 'correct_answer', 'explain', 'question_count'],
- 'detail' => ['id'],
- 'set_high_freq' => ['id', 'is_high_freq'],
- ];
- /**
- * 获取已定义验证规则的错误消息
- *
- * @return array
- */
- public function messages()
- {
- return [
- 'title.required' => '标题必填',
- 'explain.required' => '题目解析必填',
- 'correct_answer.required' => '正确答案必填',
- 'id.required' => 'ID未知',
- 'id.integer' => 'ID格式错误',
- 'id.gt' => 'ID必须大于0',
- 'page.integer' => '页码格式错误',
- 'page.min' => '页码格式错误',
- 'limit.integer' => '每页数量格式错误',
- 'limit.min' => '每页数量格式错误',
- // 'chapter_id.required' => '科目ID未知',
- // 'chapter_id.integer' => '科目ID格式错误',
- // 'chapter_id.gt' => '科目ID必须大于0',
- 'detail.required' => '考点内容必填',
- 'style.required' => '题目类型未知',
- 'style.integer' => '题目类型格式错误',
- 'style.in' => '题目类型格式错误',
- 'question_count.required' => '选项数量未知',
- 'question_count.integer' => '选项数量格式错误',
- 'question_count.gt' => '选项数量必须大于0',
- 'is_high_freq.required' => '是否高频考题未知',
- 'is_high_freq.integer' => '是否高频考题格式错误',
- 'is_high_freq.in' => '是否高频考题格式错误',
- ];
- }
- }
|