File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
src/Jenssegers/Mongodb/Schema Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -106,11 +106,36 @@ public function drop($collection)
106
106
return $ blueprint ->drop ();
107
107
}
108
108
109
+ /**
110
+ * @inheritdoc
111
+ */
112
+ public function dropAllTables ()
113
+ {
114
+ foreach ($ this ->getAllCollections () as $ collection ) {
115
+ $ this ->drop ($ collection );
116
+ }
117
+ }
118
+
109
119
/**
110
120
* @inheritdoc
111
121
*/
112
122
protected function createBlueprint ($ collection , Closure $ callback = null )
113
123
{
114
124
return new Blueprint ($ this ->connection , $ collection );
115
125
}
126
+
127
+ /**
128
+ * Get all of the collections names for the database.
129
+ *
130
+ * @return array
131
+ */
132
+ protected function getAllCollections ()
133
+ {
134
+ $ collections = [];
135
+ foreach ($ this ->connection ->getMongoDB ()->listCollections () as $ collection ) {
136
+ $ collections [] = $ collection ->getName ();
137
+ }
138
+
139
+ return $ collections ;
140
+ }
116
141
}
You can’t perform that action at this time.
0 commit comments