Index: app/Http/Controllers/Dashboard/DepartmentsController.php
===================================================================
--- app/Http/Controllers/Dashboard/DepartmentsController.php	(revision 68694d47c1e43d554d4d18e37f2fad64e05f7df4)
+++ app/Http/Controllers/Dashboard/DepartmentsController.php	(revision 2740efc8689593a89ed119462d091e66adfe645c)
@@ -119,33 +119,32 @@
     public function downloadAll()
     {
-        $zip_file = Storage::disk('uploads')->path('Departments.zip');
-        $zip = new \ZipArchive();
-        $zip->open($zip_file, \ZipArchive::CREATE | \ZipArchive::OVERWRITE);
+        try {
+            $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');
+            $path = Storage::disk('uploads')->path('Departments');
 
-        try {
             $files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path));
-        }
-        catch(\Exception $e){
-            Alert::flash("All departments are empty", "warning");
-            return redirect()->back();
-        }
 
             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);
         }
-                $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");
+        return redirect()->back();
+    }
     }
 
