| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- namespace App\Http\Requests\QuestionBank\QuestionReception;
- use App\Http\Requests\BaseRequest;
- class QuestionTopic extends BaseRequest
- {
- /**
- * 获取应用于请求的规则
- *
- * @return array
- */
- public function rules()
- {
- // 返回结果
- return [
- //'name' => 'required',
- 'id' => 'required|integer|gt:0',
- //'status' => 'required|integer|in:0,1',
- 'page' => 'integer|min:1',
- 'limit' => 'integer|min:1',
- 'user_exercise_paper_id' => 'required|integer|gt:0',
- 'chapter_id' => 'required|integer|gt:0',
- ];
- }
- // 场景列表
- protected $scenes = [
- 'list' => ['id', 'page', 'limit', 'user_exercise_paper_id'],
- 'set_favorite' => ['id', 'chapter_id'],
- 'cancel_favorite' => ['id', 'chapter_id'],
- 'answer_topic' => ['id', 'chapter_id'],
- 'get_user_exercise_paper' => ['chapter_id'],
- 'user_submit_exercise_paper' => ['chapter_id', 'user_exercise_paper_id'],
- 'set_user_new_exercise_paper' => ['chapter_id'],
- ];
- /**
- * 获取已定义验证规则的错误消息
- *
- * @return array
- */
- public function messages()
- {
- return [
- 'id.required' => 'ID未知',
- 'id.integer' => 'ID格式错误',
- 'id.gt' => 'ID格式错误',
- 'page.integer' => '页码格式错误',
- 'page.min' => '页码格式错误',
- 'limit.integer' => '每页数量格式错误',
- 'limit.min' => '每页数量格式错误',
- 'chapter_id.required' => '章节ID未知',
- 'chapter_id.integer' => '章节ID格式错误',
- 'chapter_id.gt' => '章节ID格式错误',
- 'user_exercise_paper_id.required' => '练习册ID未知',
- 'user_exercise_paper_id.integer' => '练习册ID格式错误',
- 'user_exercise_paper_id.gt' => '练习册ID格式错误',
- ];
- }
- }
|