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)
106106 return $ blueprint ->drop ();
107107 }
108108
109+ /**
110+ * @inheritdoc
111+ */
112+ public function dropAllTables ()
113+ {
114+ foreach ($ this ->getAllCollections () as $ collection ) {
115+ $ this ->drop ($ collection );
116+ }
117+ }
118+
109119 /**
110120 * @inheritdoc
111121 */
112122 protected function createBlueprint ($ collection , Closure $ callback = null )
113123 {
114124 return new Blueprint ($ this ->connection , $ collection );
115125 }
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+ }
116141}
You can’t perform that action at this time.
0 commit comments