belongsTo(Goods::class,'goods_id','id'); } public function param() { return $this->belongsTo(GoodsParams::class,'goods_param_id','id'); } protected function getRuleTextAttribute() { switch ($this->rule_sign) { case 'SHELVE_MANAGER': return '入库:初始化库存'; case 'UNSHELVE_MANAGER': return '出库:管理员删除商品'; case 'MALL_GOODS': return '出库:用户购买商品'; case 'PLUS_MANAGER': return '入库:管理员商品补仓'; case 'MINUS_MANAGER': return '出库:管理员出库商品'; default: return '未知情况'; } } }