作者 王智

daima

@@ -43,32 +43,32 @@ class Renwu extends Backend @@ -43,32 +43,32 @@ class Renwu extends Backend
43 $this->relationSearch = true; 43 $this->relationSearch = true;
44 //设置过滤方法 44 //设置过滤方法
45 $this->request->filter(['strip_tags', 'trim']); 45 $this->request->filter(['strip_tags', 'trim']);
46 - if ($this->request->isAjax())  
47 - { 46 + if ($this->request->isAjax()) {
48 //如果发送的来源是Selectpage,则转发到Selectpage 47 //如果发送的来源是Selectpage,则转发到Selectpage
49 - if ($this->request->request('keyField'))  
50 - { 48 + if ($this->request->request('keyField')) {
51 return $this->selectpage(); 49 return $this->selectpage();
52 } 50 }
53 list($where, $sort, $order, $offset, $limit) = $this->buildparams(); 51 list($where, $sort, $order, $offset, $limit) = $this->buildparams();
54 $total = $this->model 52 $total = $this->model
55 - ->with(['user','vip'])  
56 - ->where($where)  
57 - ->order($sort, $order)  
58 - ->count(); 53 + ->with(['user', 'vip'])
  54 + ->where($where)
  55 + ->order($sort, $order)
  56 + ->count();
59 57
60 $list = $this->model 58 $list = $this->model
61 - ->with(['user','vip'])  
62 - ->where($where)  
63 - ->order($sort, $order)  
64 - ->limit($offset, $limit)  
65 - ->select(); 59 + ->with(['user', 'vip'])
  60 + ->where($where)
  61 + ->order($sort, $order)
  62 + ->limit($offset, $limit)
  63 + ->select();
66 64
67 foreach ($list as $row) { 65 foreach ($list as $row) {
68 66
69 - $row->getRelation('user')->visible(['nickname','mobile','address','address_con','car_num','color','car_type','vip']);  
70 - $row->getRelation('vip')->visible(['title']); 67 + $row->getRelation('user')->visible(['nickname', 'mobile', 'address', 'address_con', 'car_num', 'color', 'car_type', 'vip']);
  68 + $row->getRelation('vip')->visible(['title']);
71 } 69 }
  70 + dump($list);
  71 + die;
72 $list = collection($list)->toArray(); 72 $list = collection($list)->toArray();
73 $result = array("total" => $total, "rows" => $list); 73 $result = array("total" => $total, "rows" => $list);
74 74