TutorialSave.php 851 B

1234567891011121314151617181920212223242526272829303132333435
  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. 'category' => 'required|in:windows,macos,ios,android,linux,router',
  9. 'description' => 'required',
  10. 'icon' => 'required'
  11. ];
  12. /**
  13. * Get the validation rules that apply to the request.
  14. *
  15. * @return array
  16. */
  17. public function rules()
  18. {
  19. return self::RULES;
  20. }
  21. public function messages()
  22. {
  23. return [
  24. 'title.required' => '标题不能为空',
  25. 'category.required' => '分类不能为空',
  26. 'category.in' => '分类格式不正确',
  27. 'description.required' => '描述不能为空',
  28. 'icon.required' => '图标不能为空'
  29. ];
  30. }
  31. }