$input = '[ { "table_name": "dp", "field_name": "dpcryptfeat", "field_col_num": "6" }, { "table_name": "dp", "field_name": "dppath", "field_col_num": "4" }, { "table_name": "dp", "field_name": "dpauthfeat", "field_col_num": "5" }, { "table_name": "dp", "field_name": "dpnick", "field_col_num": "3" }, { "table_name": "icc", "field_name": "iccbufsizeprot", "field_col_num": "13" }, { "table_name": "icc", "field_name": "iccmech", "field_col_num": "5" }, { "table_name": "icc", "field_name": "iccnick", "field_col_num": "3" }, { "table_name": "icc", "field_name": "iccprocmanager", "field_col_num": "8" }, { "table_name": "icc", "field_name": "iccdesc", "field_col_num": "4" }, { "table_name": "icc", "field_name": "iccprot", "field_col_num": "6" }, { "table_name": "icc", "field_name": "iccformatprot", "field_col_num": "14" } ]';
dd(collect(json_decode($input))->groupBy('table_name')->map(function($item){
return collect($item)->sortBy('field_col_num')->map(function($data) {
return $data->field_name;
})->values();
})->toJson());
哈哈,忍不住试也下。。