From 4afee9c8b82e14c93e8ef4e1f217fef5514914f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=82=A0=E6=82=A0=E5=B1=B1=E9=9B=A8?= Date: Fri, 6 Jan 2017 15:10:59 +0800 Subject: [PATCH] Update BelongsToMany.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 给$data默认值NULL,用于删除以关联外键为条件的中间表 --- library/think/model/relation/BelongsToMany.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/think/model/relation/BelongsToMany.php b/library/think/model/relation/BelongsToMany.php index bbab3714..428620a2 100644 --- a/library/think/model/relation/BelongsToMany.php +++ b/library/think/model/relation/BelongsToMany.php @@ -308,7 +308,7 @@ class BelongsToMany extends Relation * @param bool $relationDel 是否同时删除关联表数据 * @return integer */ - public function detach($data, $relationDel = false) + public function detach($data = null, $relationDel = false) { if (is_array($data)) { $id = $data;