Index: app/Http/Requests/Dashboard/DocumentRequest.php
===================================================================
--- app/Http/Requests/Dashboard/DocumentRequest.php	(revision ea7b12a15d1afa472a54d5b8c75c55917907862e)
+++ 	(revision )
@@ -1,72 +1,0 @@
-<?php
-
-namespace App\Http\Requests\Dashboard;
-
-use App\Models\Department;
-use App\Models\Document;
-use Illuminate\Foundation\Http\FormRequest;
-
-class DocumentRequest extends FormRequest
-{
-    /**
-     * Determine if the user is authorized to make this request.
-     *
-     * @return bool
-     */
-    public function authorize()
-    {
-        if ($this->isMethod("patch")) {
-            $document = Document::find($this->route("id"));
-            return auth()->user()->hasPermission("edit_all_documents") || ($document->user->id == auth()->user()->id);
-        }
-
-        return true;
-    }
-
-    /**
-     * Get the validation rules that apply to the request.
-     *
-     * @return array
-     */
-    public function rules()
-    {
-        $rules = [
-            "arch_id" => [
-                "required",
-                function ($attribute, $value, $fail) {
-                    $arch_id = $this->request->get('arch_id');
-                    $deptId = explode('/', $arch_id)[0];
-                    $archNum = explode('/', $arch_id)[1];
-
-                    if (empty($archNum)) {
-                        $fail("Please enter documents Archive ID");
-                    }
-
-                    if ($deptId !== Department::find($this->request->get('department'))->code) {
-                        $fail("Document Archive ID field format is invalid");
-                    }
-                }
-            ],
-            "name" => "required|min:10|max:255",
-            "department" => "required|integer|exists:departments,id",
-            "description" => "required|min:30",
-        ];
-
-        if ($this->isMethod("patch")) {
-            $fileRules = [
-                "file_item.*" => "mimes:jpg,jpeg,png,pdf|max:4096"
-            ];
-        } else {
-            $fileRules = [
-                "file_item.*" => "mimes:jpg,jpeg,png,pdf|max:4096"
-            ];
-        }
-
-        $rules = array_merge(
-            $rules,
-            $fileRules,
-        );
-
-        return $rules;
-    }
-}
Index: app/Http/Requests/Dashboard/FileNameRequest.php
===================================================================
--- app/Http/Requests/Dashboard/FileNameRequest.php	(revision c6b84df06586305606df5b76204a64cdc63b09a2)
+++ app/Http/Requests/Dashboard/FileNameRequest.php	(revision c6b84df06586305606df5b76204a64cdc63b09a2)
@@ -0,0 +1,30 @@
+<?php
+
+namespace App\Http\Requests\Dashboard;
+
+use Illuminate\Foundation\Http\FormRequest;
+
+class FileNameRequest extends FormRequest
+{
+    /**
+     * Determine if the user is authorized to make this request.
+     *
+     * @return bool
+     */
+    public function authorize()
+    {
+        return true;
+    }
+
+    /**
+     * Get the validation rules that apply to the request.
+     *
+     * @return array
+     */
+    public function rules()
+    {
+        return [
+            "name" => ['required', 'max:255', 'regex:/^[^.\/|]+$/', 'unique:files,name,$this->id,id']
+        ];
+    }
+}
Index: app/Http/Requests/Dashboard/FileRequest.php
===================================================================
--- app/Http/Requests/Dashboard/FileRequest.php	(revision ea7b12a15d1afa472a54d5b8c75c55917907862e)
+++ app/Http/Requests/Dashboard/FileRequest.php	(revision c6b84df06586305606df5b76204a64cdc63b09a2)
@@ -3,4 +3,7 @@
 namespace App\Http\Requests\Dashboard;
 
+use App\Helpers\Alert;
+use App\Models\FileType;
+use App\Rules\UploadCount;
 use Illuminate\Foundation\Http\FormRequest;
 
@@ -24,7 +27,29 @@
     public function rules()
     {
-        return [
-            "name" => "required|max:255|regex:/^[^.]+$/",
-        ];
+        $rules = [
+            "folder" => "required|integer|exists:folders,id",
+            ];
+
+        $mimes = FileType::find("1")->mimes;
+        $maxSize = FileType::find("1")->max_size;
+
+        if ($this->isMethod("patch")) {
+            $fileRules = [
+                "file_item.*" => "mimes:{$mimes}|max:{$maxSize}"
+            ];
+        }
+
+        else {
+            $fileRules = [
+                "file_item.*" => "mimes:{$mimes}|max:{$maxSize}"
+            ];
+        }
+
+        $rules = array_merge(
+            $rules,
+            $fileRules,
+        );
+
+        return $rules;
     }
 }
Index: app/Http/Requests/Dashboard/FileTypeRequest.php
===================================================================
--- app/Http/Requests/Dashboard/FileTypeRequest.php	(revision c6b84df06586305606df5b76204a64cdc63b09a2)
+++ app/Http/Requests/Dashboard/FileTypeRequest.php	(revision c6b84df06586305606df5b76204a64cdc63b09a2)
@@ -0,0 +1,63 @@
+<?php
+
+namespace App\Http\Requests\Dashboard;
+
+use Illuminate\Foundation\Http\FormRequest;
+use League\Flysystem\Util\MimeType;
+use League\MimeTypeDetection\MimeTypeDetector;
+
+class FileTypeRequest extends FormRequest
+{
+    /**
+     * Determine if the user is authorized to make this request.
+     *
+     * @return bool
+     */
+    public function authorize()
+    {
+        return true;
+    }
+
+    /**
+     * Get the validation rules that apply to the request.
+     *
+     * @return array
+     */
+    public function rules()
+    {
+        return [
+            "mimes" => [
+                "required",
+//                function ($attribute, $value, $fail) {
+//
+//                    try {
+//                        $mimeType = mimes;
+//                        @dd($mimeType);
+//                        $mimetypes = $guesser->guess($pubdir . $avatar);
+////                        if ($mimetypes == null) {
+////                            $validator->errors()->add('avatar', 'No valid Mime/Type');
+////                            return $validator;
+////                        }
+////                    }
+////
+////$mime= explode ('/', $mimetypes);
+////if ($mime[0] != 'image') {
+////    $validator->errors()->add('avatar', 'Not a valid image');
+////}
+//
+//                        if (empty($archNum)) {
+//                            $fail("Please enter folders Archive ID");
+//                        }
+//
+//                        if ($deptId !== Department::find($this->request->get('department'))->code) {
+//                            $fail("Folder Archive ID field format is invalid");
+//                        }
+//                    } catch (\Exception $e) {
+//                        $fail("Please enter folders Archive ID");
+//                    }
+//                }
+            ],
+            "max_size" => "required|integer",
+        ];
+    }
+}
Index: app/Http/Requests/Dashboard/FolderRequest.php
===================================================================
--- app/Http/Requests/Dashboard/FolderRequest.php	(revision c6b84df06586305606df5b76204a64cdc63b09a2)
+++ app/Http/Requests/Dashboard/FolderRequest.php	(revision c6b84df06586305606df5b76204a64cdc63b09a2)
@@ -0,0 +1,84 @@
+<?php
+
+namespace App\Http\Requests\Dashboard;
+
+use App\Models\Department;
+use App\Models\FileType;
+use App\Models\Folder;
+use Illuminate\Foundation\Http\FormRequest;
+
+class FolderRequest extends FormRequest
+{
+    /**
+     * Determine if the user is authorized to make this request.
+     *
+     * @return bool
+     */
+    public function authorize()
+    {
+        if ($this->isMethod("patch")) {
+            $folder = Folder::find($this->route("id"));
+            return auth()->user()->hasPermission("edit_all_folders") || ($folder->user->id == auth()->user()->id);
+        }
+
+        return true;
+    }
+
+    /**
+     * Get the validation rules that apply to the request.
+     *
+     * @return array
+     */
+    public function rules()
+    {
+        $rules = [
+            "arch_id" => [
+                "required",
+                "unique:folders,arch_id,$this->id,id",
+                function ($attribute, $value, $fail) {
+
+                    try {
+                        $arch_id = $this->request->get('arch_id');
+
+                        $deptId = explode('/', $arch_id)[0];
+                        $archNum = explode('/', $arch_id)[1];
+
+                        if (empty($archNum)) {
+                            $fail("Please enter folders Archive ID");
+                        }
+
+                        if ($deptId !== Department::find($this->request->get('department'))->code) {
+                            $fail("Folder Archive ID field format is invalid");
+                        }
+                    } catch (\Exception $e) {
+                        $fail("Please enter folders Archive ID");
+                    }
+                }
+            ],
+            "name" => "required|min:2|max:30",
+            "department" => "required|integer|exists:departments,id",
+        ];
+
+        $mimes = FileType::find("1")->mimes;
+        $maxSize = FileType::find("1")->max_size;
+
+        if ($this->isMethod("patch")) {
+            $fileRules = [
+                "file_item.*" => "mimes:{$mimes}|max:{$maxSize}"
+            ];
+        }
+
+        else {
+            $fileRules = [
+                "file_item.*" => "mimes:{$mimes}|max:{$maxSize}"
+            ];
+        }
+
+        $rules = array_merge(
+            $rules,
+            $fileRules,
+        );
+
+        return $rules;
+    }
+}
Index: app/Http/Requests/Dashboard/NewUserRequest.php
===================================================================
--- app/Http/Requests/Dashboard/NewUserRequest.php	(revision ea7b12a15d1afa472a54d5b8c75c55917907862e)
+++ app/Http/Requests/Dashboard/NewUserRequest.php	(revision c6b84df06586305606df5b76204a64cdc63b09a2)
@@ -29,7 +29,7 @@
             "phone_number" => "required|unique:users,phone_number",
             "email" => "required|string|email|max:50|unique:users,email",
-            "username" => "required|min:5|max:30|unique:users,username",
+            "username" => "required|alpha_dash|min:5|unique:users,username",
             "userRole" => "required|exists:roles,id",
-            "avatar" => "mimes:jpeg,png,gif|max:5000",
+            "avatar" => "image|max:5000",
         ];
     }
Index: app/Http/Requests/Dashboard/UpdateUserRequest.php
===================================================================
--- app/Http/Requests/Dashboard/UpdateUserRequest.php	(revision ea7b12a15d1afa472a54d5b8c75c55917907862e)
+++ app/Http/Requests/Dashboard/UpdateUserRequest.php	(revision c6b84df06586305606df5b76204a64cdc63b09a2)
@@ -29,5 +29,5 @@
             "phone_number" => "required|unique:users,phone_number,$this->id,id",
             "email" => "required|string|email|max:50|unique:users,email,$this->id,id",
-            "username" => "required|min:5|unique:users,username,$this->id,id",
+            "username" => "required|alpha_dash|min:5|unique:users,username,$this->id,id",
             "userRole" => "required|exists:roles,id",
             "avatar" => "mimes:jpeg,png,gif|max:5000",
