newQuery()->where('id','0'); } $ownerIds=$user->getPermittingOwnerIdsAttribute(); return (new static)->newQuery()->whereIn('id',$ownerIds); } 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'); } }