get('statusList', ''); $name = $request->get('name', ''); $statusListArray = explode(',', $statusList); $statusListSelected = []; foreach(Customer::$statusList as $k => $v){ $tmpItem = [ 'name' => $v, 'value' => $k ]; if(in_array($k, $statusListArray)){ $tmpItem['selected'] = true; } $statusListSelected[] = $tmpItem; } return view('customer/index', ['statusList' => $statusList, 'name' => $name, 'statusListSelected' => json_encode($statusListSelected)]); } public function apiGetList(Request $request) { $statusList = $request->get('statusList', ''); $name = $request->get('name', ''); $list = Customer::getPageList($statusList, $name); return json(['code' => 0, 'msg' => 'ok', 'list' => $list]); } }