TutorialSave.php 795 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace App\Http\Requests\Admin;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. class TutorialSave extends FormRequest
  5. {
  6. /**
  7. * Get the validation rules that apply to the request.
  8. *
  9. * @return array
  10. */
  11. public function rules()
  12. {
  13. return [
  14. 'title' => 'required',
  15. // 1:windows 2:macos 3:ios 4:android 5:linux 6:router
  16. 'category_id' => 'required|in:1,2,3,4,5,6',
  17. 'steps' => 'required'
  18. ];
  19. }
  20. public function messages()
  21. {
  22. return [
  23. 'title.required' => '标题不能为空',
  24. 'category_id.required' => '分类不能为空',
  25. 'category_id.in' => '分类格式不正确',
  26. 'steps.required' => '教程步骤不能为空'
  27. ];
  28. }
  29. }