Пример #1
0
 /**
  * 获取公司列表
  *
  */
 public function all()
 {
     $query = Company::select('id', 'name', 'brief', 'logo', 'field_id', 'address')->withOnly('customer', ['id', 'company_id', 'name', 'position', 'avatar'])->withOnly('field', ['id', 'name'])->where('status', 1)->orderBy('id', 'desc');
     //判断搜索条件
     if ($this->request->has('field') && $this->request->get('field') > 0) {
         $field = $this->request->get('field');
         $query->searchField($field);
     }
     //
     $company = $query->paginate(15)->toArray();
     return return_rest('1', compact('company'), '公司列表');
 }