AgentSaveRequest.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace App\Http\Requests\Sell;
  3. use App\Http\Requests\Request;
  4. use Illuminate\Database\Query\Builder;
  5. use Illuminate\Validation\Rule;
  6. class AgentSaveRequest 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. 'agent_type' => 'required',
  29. // 'user_id' => [
  30. // 'required',
  31. // Rule::unique('agent_sellers')->where(function (Builder $query) {
  32. // return $query->where('deleted_at', null);
  33. // })->ignore($this->route('id'))
  34. // ],
  35. 'user_id' => 'nullable',
  36. 'company_name' => 'required',
  37. 'area' => 'required',
  38. 'channel_ids' => 'required|array',
  39. 'sign_at' => 'required',
  40. 'contact_name' => 'required',
  41. 'mobile' => 'required',
  42. 'tencent' => 'nullable',
  43. 'discount' => 'required|integer|min:1',
  44. 'cash_deposit' => 'required',
  45. ];
  46. }
  47. public function attributes()
  48. {
  49. return [
  50. 'agent_type' => '代理商类型',
  51. 'user_id' => '人员',
  52. 'company_name' => '公司名称',
  53. 'area' => '所在区域',
  54. 'channel_ids' => '渠道人员',
  55. 'sign_at' => '签约时间',
  56. 'contact_name' => '联系人',
  57. 'mobile' => '手机号',
  58. 'tencent' => '微信号/QQ号',
  59. 'discount' => '折扣',
  60. 'cash_deposit' => '保证金/预充值'
  61. ];
  62. }
  63. }