configCityManagementRepository = $configCityManagementRepository; } //已开通城市列表 public function index(Request $request) { $cityList = $this->configCityManagementRepository->index($request->all()); if (count($cityList) > 0) { foreach ($cityList as $k => $v) { if ($v->status == 0) { $cityList[$k]->status = '启用'; } else { $cityList[$k]->status = '禁用'; } if ($v->express_type == "0"){ $cityList[$k]->express_type = '快递'; }elseif ($v->express_type == "1"){ $cityList[$k]->express_type = '自提'; }elseif ($v->express_type === "0,1" || $v->express_type === "1,0"){ $cityList[$k]->express_type = '快递,自提'; } } } $fractal = new Manager(); $resource = new Collection($cityList , new CityTransformer()); $resource->setPaginator(new IlluminatePaginatorAdapter($cityList)); $data = $fractal->createData($resource)->toArray(); return $this->jsonSuccess($data); } }