CaseSaveRequest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace App\Http\Requests\Link;
  3. use App\Http\Requests\Request;
  4. use Illuminate\Validation\Rule;
  5. use Illuminate\Database\Query\Builder;
  6. class CaseSaveRequest extends Request
  7. {
  8. /**
  9. * Determine if the user is authorized to make this request.
  10. *
  11. * @return bool
  12. */
  13. public function authorize()
  14. {
  15. return true;
  16. }
  17. /**
  18. * Get the validation rules that apply to the request.
  19. *
  20. * @return array
  21. */
  22. public function rules()
  23. {
  24. if (!$this->ajax()) {
  25. return [];
  26. }
  27. return [
  28. 'type' => 'required',
  29. 'url' => 'nullable',
  30. 'username_history' => 'nullable',
  31. 'email_history' => 'nullable',
  32. 'password_history' => 'nullable',
  33. 'url_history' => 'nullable',
  34. ];
  35. }
  36. public function attributes()
  37. {
  38. return [
  39. 'type' => '外链类型',
  40. 'url' => '平台链接',
  41. 'url_history' => 'profile演示地址',
  42. 'username_history' => '用户名',
  43. 'email_history' => '邮箱',
  44. 'password_history' => '密码',
  45. ];
  46. }
  47. }