order('id', 'DESC') ->select() as $model) { $assoc[$model->getAttr('id')] = $model->getAttr('name'); } } return $assoc; } /** * 商品数量 * * @return ProductModel */ public function productNum() { return ProductModel::where(1) ->where('group_id', $this->getAttr('id')) ->count(); } }