CustomerRequest.php 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <?php
  2. namespace App\Http\Requests\Site;
  3. use App\Http\Requests\Request;
  4. class CustomerRequest 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->method() == 'GET') {
  23. return [];
  24. }
  25. switch ($this->input('act')) {
  26. case 'addition':
  27. return [
  28. 'addition.domain_type' => 'required',
  29. 'addition.new_domain' => 'nullable',
  30. 'addition.old_domain' => 'nullable',
  31. 'addition.old_account' => 'nullable',
  32. 'addition.old_password' => 'nullable',
  33. 'addition.old_url' => 'nullable',
  34. 'addition.old_expired' => 'nullable',
  35. 'addition.site_url' => 'nullable',
  36. 'addition.site_account' => 'nullable',
  37. 'addition.site_password' => 'nullable',
  38. 'addition.ftp_account' => 'nullable',
  39. 'addition.ftp_domain' => 'nullable',
  40. 'addition.ftp_password' => 'nullable',
  41. 'addition.ftp_port' => 'nullable',
  42. 'addition.ftp_ip' => 'nullable'
  43. ];
  44. case 'keyword':
  45. return [
  46. 'keyword' => 'nullable|array'
  47. ];
  48. case 'station':
  49. return [
  50. 'station.other_sites' => 'nullable|array',
  51. 'station.portal_sites' => 'nullable|array',
  52. 'station.compete_sites' => 'nullable|array'
  53. ];
  54. case 'enterprise':
  55. return [
  56. 'enterprise.export_region' => 'nullable',
  57. 'enterprise.business_id' => 'nullable',
  58. 'enterprise.nature_type' => 'nullable',
  59. 'enterprise.company_nature' => 'nullable',
  60. 'enterprise.company_size' => 'nullable',
  61. 'enterprise.customer_scope' => 'nullable',
  62. 'enterprise.brand' => 'nullable',
  63. 'enterprise.cn_title' => 'nullable',
  64. 'enterprise.cn_profile' => 'nullable',
  65. 'enterprise.cn_address' => 'nullable',
  66. 'enterprise.en_slogan' => 'nullable',
  67. 'enterprise.en_title' => 'nullable',
  68. 'enterprise.en_profile' => 'nullable',
  69. 'enterprise.en_address' => 'nullable',
  70. 'enterprise.setup_time' => 'nullable',
  71. 'enterprise.postcode' => 'nullable',
  72. 'enterprise.line_phone' => 'nullable',
  73. 'enterprise.fax' => 'nullable',
  74. 'enterprise.email' => 'nullable',
  75. 'enterprise.deliver_period' => 'nullable',
  76. 'enterprise.supply' => 'nullable',
  77. 'enterprise.min_supply' => 'nullable',
  78. 'enterprise.price_range' => 'nullable',
  79. 'enterprise.packing_way' => 'nullable',
  80. 'enterprise.pay_way' => 'nullable',
  81. 'enterprise.skype' => 'nullable',
  82. 'enterprise.whats_app' => 'nullable',
  83. 'enterprise.wechat' => 'nullable',
  84. 'enterprise.qq' => 'nullable',
  85. 'enterprise.other' => 'nullable'
  86. ];
  87. case 'marketer':
  88. return [
  89. 'marketer.en_name' => 'nullable',
  90. 'marketer.en_profile' => 'nullable',
  91. 'marketer.sex_text' => 'nullable',
  92. 'marketer.birthday' => 'nullable',
  93. 'marketer.position' => 'nullable',
  94. 'marketer.department' => 'nullable',
  95. 'marketer.contact' => 'nullable',
  96. 'marketer.enterprise_email' => 'nullable',
  97. 'marketer.enterprise_login_url' => 'nullable',
  98. 'marketer.enterprise_email_password' => 'nullable',
  99. 'marketer.gmail_account' => 'nullable',
  100. 'marketer.gmail_password' => 'nullable',
  101. 'marketer.gmail_contact' => 'nullable',
  102. 'marketer.gmail_assist' => 'nullable',
  103. ];
  104. case 'sns':
  105. return [
  106. 'sns.youtube_url' => 'nullable',
  107. 'sns.youtube_account' => 'nullable',
  108. 'sns.youtube_password' => 'nullable',
  109. 'sns.facebook_my_url' => 'nullable',
  110. 'sns.facebook_url' => 'nullable',
  111. 'sns.facebook_account' => 'nullable',
  112. 'sns.facebook_password' => 'nullable',
  113. 'sns.twitter_url' => 'nullable',
  114. 'sns.twitter_account' => 'nullable',
  115. 'sns.twitter_password' => 'nullable',
  116. 'sns.linkedin_my_url' => 'nullable',
  117. 'sns.linkedin_url' => 'nullable',
  118. 'sns.linkedin_account' => 'nullable',
  119. 'sns.linkedin_password' => 'nullable',
  120. 'sns.pinterst_url' => 'nullable',
  121. 'sns.pinterst_account' => 'nullable',
  122. 'sns.pinterst_password' => 'nullable'
  123. ];
  124. default:
  125. return [];
  126. }
  127. }
  128. public function messages()
  129. {
  130. $all = parent::messages();
  131. $all['required_if'] = ':attribute 不能为空';
  132. return $all;
  133. }
  134. public function attributes()
  135. {
  136. return [
  137. 'addition.domain_type' => '是否新域名注册',
  138. 'addition.new_domain' => '新域名',
  139. 'addition.old_domain' => '旧域名',
  140. 'addition.old_account' => '旧域名登录账号',
  141. 'addition.old_password' => '旧域名密码',
  142. 'addition.old_url' => '旧域名注册网址',
  143. 'addition.old_expired' => '旧域名到期时间',
  144. 'addition.site_url' => '网站后台地址',
  145. 'addition.site_account' => '网站后台用户名',
  146. 'addition.site_password' => '网站后台密码',
  147. 'addition.ftp_account' => 'ftp账号',
  148. 'addition.ftp_domain' => 'ftp域名',
  149. 'addition.ftp_password' => 'ftp密码',
  150. 'addition.ftp_port' => 'fpt端口号',
  151. 'addition.ftp_ip' => 'ftp ip地址',
  152. 'keyword.keyword' => '关键词',
  153. 'station.other_sites' => '公司其他网站',
  154. 'station.portal_sites' => '行业门户网站',
  155. 'station.compete_sites' => '竞争对手网站',
  156. 'enterprise.export_region' => '主要出口国家或市场',
  157. 'enterprise.business' => '所属行业',
  158. 'enterprise.company_type' => '公司类型',
  159. 'enterprise.customer_scope' => '客户群体*',
  160. 'enterprise.brand' => '品牌',
  161. 'enterprise.cn_title' => '公司名称(中文)',
  162. 'enterprise.cn_profile' => '公司简介(中文)*',
  163. 'enterprise.cn_address' => '公司地址(中文)',
  164. 'enterprise.en_title' => '公司名称(英文)',
  165. 'enterprise.en_profile' => '公司简介(英文)',
  166. 'enterprise.en_address' => '公司地址(英文)',
  167. 'enterprise.setup_time' => '公司成立时间*',
  168. 'enterprise.postcode' => '邮编',
  169. 'enterprise.line_phone' => '公司座机',
  170. 'enterprise.fax' => '公司传真',
  171. 'enterprise.email' => '公司邮箱',
  172. 'enterprise.deliver_period' => '发货期',
  173. 'enterprise.supply' => '供应量',
  174. 'enterprise.min_supply' => '最低供应量',
  175. 'enterprise.price_range' => '价格区间',
  176. 'enterprise.packing_way' => '包装方式',
  177. 'enterprise.pay_way' => '支付方式',
  178. 'enterprise.skype' => 'Skype账号',
  179. 'enterprise.whats_app' => 'Whatsapp手机号',
  180. 'enterprise.wechat' => 'Wechat 二维码',
  181. 'enterprise.qq' => 'QQ',
  182. 'enterprise.other' => '其他',
  183. 'marketer.en_name' => '联系人英文姓名',
  184. 'marketer.en_profile' => '联系人简介',
  185. 'marketer.sex_text' => '联系人性别',
  186. 'marketer.birthday' => '联系人出生年月',
  187. 'marketer.position' => '联系人职位',
  188. 'marketer.department' => '联系人部门',
  189. 'marketer.contact' => '联系人电话',
  190. 'marketer.enterprise_email' => '企业邮箱',
  191. 'marketer.enterprise_login_url' => '企业邮箱登录地址',
  192. 'marketer.enterprise_email_password' => '企业邮箱密码',
  193. 'marketer.gmail_account' => 'Gmail邮箱',
  194. 'marketer.gmail_password' => 'Gmail*密码',
  195. 'marketer.gmail_contact' => 'Gmail验证手机号码',
  196. 'marketer.gmail_assist' => 'Gmail辅助邮箱',
  197. 'sns.youtube_url' => 'youtube展示url地址',
  198. 'sns.youtube_account' => 'youtube登入邮箱',
  199. 'sns.youtube_password' => 'youtube密码',
  200. 'sns.facebook_url' => 'facebook展示url地址',
  201. 'sns.facebook_account' => 'facebook登入邮箱',
  202. 'sns.facebook_password' => 'facebook密码',
  203. 'sns.twitter_url' => 'twitter展示url地址',
  204. 'sns.twitter_account' => 'twitter登入邮箱',
  205. 'sns.twitter_password' => 'twitter密码',
  206. 'sns.linkedin_url' => 'linkedin展示url地址',
  207. 'sns.linkedin_account' => 'linkedin登入邮箱',
  208. 'sns.linkedin_password' => 'linkedin密码',
  209. 'sns.pinterst_url' => 'pinterst展示url地址',
  210. 'sns.pinterst_account' => 'pinterst登入邮箱',
  211. 'sns.pinterst_password' => 'pinterst密码'
  212. ];
  213. }
  214. }