get(); return $goodsDiscountInfo; } /** * 自定义字段名 * 可使用 * @return array */ public function atributeNames() { return [ // 'level_discount_type' => '等级方式', // 'discount_method' => '折扣方式', // 'level_id' => '会员等级id', // 'discount_value' => '折扣或金额数值' ]; } public function rules() { return [ // 'level_discount_type' => 'numeric', // 'discount_method' => 'numeric', // 'level_id' => 'integer', // 'discount_value' => 'numeric' ]; } public static function boot() { parent::boot(); //注册观察者 static::observe(new DiscountObserver); } }