Index: app/Http/Controllers/Dashboard/DepartmentsController.php
===================================================================
--- app/Http/Controllers/Dashboard/DepartmentsController.php	(revision 2279f71f7accf2148a6f27f2e14076af1a9159ed)
+++ app/Http/Controllers/Dashboard/DepartmentsController.php	(revision bbcbb577179b8e9951ccf301aa93e1efdb0ade7a)
@@ -119,27 +119,28 @@
     public function downloadAll()
     {
+        $zip_file = Storage::disk('uploads')->path('Departments.zip');
+        $zip = new \ZipArchive();
+        $zip->open($zip_file, \ZipArchive::CREATE | \ZipArchive::OVERWRITE);
 
-            $zip_file=Storage::disk('uploads')->path('Departments.zip');
-            $zip = new \ZipArchive();
-            $zip->open($zip_file, \ZipArchive::CREATE | \ZipArchive::OVERWRITE);
+        $path = Storage::disk('uploads')->path('Departments');
+
+        $files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path));
         try {
-            $path = Storage::disk('uploads')->path('Departments');
-
-            $files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path));
             foreach ($files as $file) {
 
-                    // We're skipping all subfolders
-                    if (!$file->isDir()) {
-                        $filePath = $file->getRealPath();
-                        // extracting filename with substr/strlen
-                        $relativePath = substr($filePath, strlen($path) + 1);
-                        $zip->addFile($filePath, $relativePath);
-                    }
-                }
+            // We're skipping all subfolders
+            if (!$file->isDir()) {
+                $filePath = $file->getRealPath();
+                // extracting filename with substr/strlen
+                $relativePath = substr($filePath, strlen($path) + 1);
+                $zip->addFile($filePath, $relativePath);
+            }
+        }
                 $zip->close();
                 $headers = array('Content-Type' => 'application/octet-stream');
                 $zip_new_name = Carbon::now()->format('d.m.Y - H:i') . '- Departments.zip';
                 return response()->download($zip_file, $zip_new_name, $headers);
-        }
+                }
+
         catch(\Exception $e){
            Alert::flash("All departments are empty", "warning");
