all())->where('type_key', 'like', 'crops-cate-%')->get(); return $this->json(KeywordResource::collection($list)); } /** * 农作物产业分类 * * @return void */ public function cropsCate(Request $request) { $cropsId = $request->input('crops_id', 0); $crops = null; if ($cropsId) { $crops = Keywords::find($cropsId); } $query = Keywords::filter($request->all())->where('type_key', 'crops-category'); if ($crops) { $query->where('id', $crops->parent_id); } $list = $query->get(); return $this->json(KeywordResource::collection($list)); } }