|
@@ -13,7 +13,13 @@ class GoodCombind extends Model
|
|
|
protected $createTime="createtime";
|
|
|
protected $updateTime="updatetime";
|
|
|
protected $append=["usable_stock"];
|
|
|
-
|
|
|
+ // 定义全局的查询范围
|
|
|
+ protected $globalScope = ['is_del'];
|
|
|
+
|
|
|
+ public function scopeIsDel($query)
|
|
|
+ {
|
|
|
+ $query->where('is_del',0);
|
|
|
+ }
|
|
|
public function getUsableStockAttr($v,$row){
|
|
|
return (new GoodStock())->withJoin(['wsminfo'] , 'left')
|
|
|
->where(['spuCode'=>$row['childCode'] , 'wsm_type'=>[2 , 5]])
|