TutorialSave.php 886 B

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