clearAllCollections(); } public function clearAllCollections() { $path = app_path('Documents'); $files = File::allFiles($path); foreach ($files as $file) { $className = str_replace('.php', '', $file->getFileName()); if ($className === 'BaseDocument'){ continue; } call_user_func('App\\Documents\\' . $className . "::truncate"); } } }