Skip to content

Commit 8289095

Browse files
committed
Added dropifExists method
1 parent 1bb259a commit 8289095

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/Jenssegers/Mongodb/Schema/Builder.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,19 @@ public function create($collection, Closure $callback = null)
9696
}
9797
}
9898

99+
/**
100+
* @inheritdoc
101+
*/
102+
public function dropIfExists($collection)
103+
{
104+
if($this->hasCollection($collection)) {
105+
106+
return $this->drop($collection);
107+
}
108+
109+
return false;
110+
}
111+
99112
/**
100113
* @inheritdoc
101114
*/

0 commit comments

Comments
 (0)