HallSaveRequest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace App\Http\Requests\Link;
  3. use App\Http\Requests\Request;
  4. class HallSaveRequest extends Request
  5. {
  6. /**
  7. * Determine if the user is authorized to make this request.
  8. *
  9. * @return bool
  10. */
  11. public function authorize()
  12. {
  13. return true;
  14. }
  15. /**
  16. * Get the validation rules that apply to the request.
  17. *
  18. * @return array
  19. */
  20. public function rules()
  21. {
  22. if (!$this->ajax()) {
  23. return [];
  24. }
  25. return [
  26. 'username' => 'required',
  27. 'email' => 'required',
  28. 'password' => 'required',
  29. 'url' => 'required',
  30. 'show_urls' => 'required|array',
  31. 'remark' => 'nullable',
  32. 'status' => 'required'
  33. ];
  34. }
  35. public function attributes()
  36. {
  37. return [
  38. 'username' => '用户名',
  39. 'email' => '邮箱',
  40. 'password' => '密码',
  41. 'url' => 'profile演示地址',
  42. 'show_urls' => '演示地址',
  43. 'remark' => '备注',
  44. 'status' => '状态'
  45. ];
  46. }
  47. }