newQuery(); if(!$user){ return $query->where('id','0'); } $ownerIds=$user->getPermittingOwnerIdsAttribute(); return $query->whereIn('id',$ownerIds); } /** * 退货管理里,客户审核的代码,是拼音+日期+计数,计数的后缀就是checking_count * @return int|mixed */ public function getIncreasedCheckingCount(){ $this['checking_count']=$this['checking_count']+1; $this->update(); return $this['checking_count']; } public function paperBoxes() { return $this->belongsToMany('\App\PaperBox', 'owner_paper_box', 'owner_id', 'paper_box_id'); } public function orderTrackingOwner(){ return $this->belongsTo(OrderTrackingOwner::class,'id','owner_id'); } public function order(){ return $this->hasOne(Order::class,'owner_id','id'); } }