UserRequest.php 979 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace App\Http\Requests;
  3. use App\Http\Requests\Request;
  4. class UserRequest 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. return [
  23. 'name'=>'required',
  24. 'pswd'=>'required',
  25. 'surname'=>'required',
  26. 'role_id'=>'required',
  27. 'department_id'=>'required',
  28. ];
  29. }
  30. public function messages()
  31. {
  32. return[
  33. 'name.required'=>'登录名不能为空',
  34. 'pswd.required'=>'密码不能为空',
  35. 'surname.required'=>'姓名不能为空',
  36. 'role_id.required'=>'职位不能为空',
  37. 'department_id.required'=>'单位机构不能为空',
  38. ];
  39. }
  40. }