validator; } /** 创建 */ public function serviceStore(Request $request, array $data = [], string $domain = '') { $data['email'] = $data['Email']; $data['name'] = $data['Name']; $data['tel'] = $data['Tel']; $data['company'] = $data['Company']; $data['country'] = $data['Country']; $data['form_Url'] = $data['Form Url']; $data['message'] = $data['Message']; $data['ip_location'] = $data['IpLocation']; $data['ip'] = $data['Ip']; $data['domain'] = $domain; return InquiryTransmit::create($data); } /** * 构造 CrudUtil 查询配置 */ protected function buildQueryConfig(Request $request, string $scene = 'default'): array { $p = $request->all(); $config = []; $config['model'] = $this->modelClass; switch ($scene) { case 'default': $config['order']['id'] = 'desc'; break; case 'index': // 域名 if (isset($p['domain']) && !empty($p['domain'])) { $config['where']['domain'] = $p['domain']; } // 关键字 if (isset($p['keyword']) && $p['keyword']) { $k = '%' . $p['keyword'] . '%'; foreach (['email', 'name', 'tel', 'country', 'message', 'form_url'] as $col) { $config['orWhere'][] = [$col, 'like', $k]; } } $config['order']['id'] = 'desc'; break; case 'show': $config['where']['id'] = $p['id']; break; case 'store': break; case 'update': $config['where']['id'] = $p['id']; break; case 'destroy': $config['where']['id'] = $p['id']; break; } return $config; } }