ProductSaveRequest.php 772 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace App\Http\Requests;
  3. class ProductSaveRequest extends Request
  4. {
  5. /**
  6. * Determine if the user is authorized to make this request.
  7. *
  8. * @return bool
  9. */
  10. public function authorize()
  11. {
  12. return true;
  13. }
  14. /**
  15. * Get the validation rules that apply to the request.
  16. *
  17. * @return array
  18. */
  19. public function rules()
  20. {
  21. if (!$this->ajax()) {
  22. return [];
  23. }
  24. return [
  25. 'title' => 'required',
  26. 'remark' => 'nullable',
  27. 'href' => 'nullable'
  28. ];
  29. }
  30. public function attributes()
  31. {
  32. return [
  33. 'title' => '标题',
  34. 'remark' => '备注',
  35. 'href'=>'链接地址'
  36. ];
  37. }
  38. }