Index: app/Http/Controllers/Auth/CreatePasswordController.php
===================================================================
--- app/Http/Controllers/Auth/CreatePasswordController.php	(revision 1f7c9345a2889dcb0e676b7862c7f5e48afd23d0)
+++ app/Http/Controllers/Auth/CreatePasswordController.php	(revision dbc59767a101ccb4d7408c635f8e1fbb4fe5457e)
@@ -36,5 +36,5 @@
         $user->save();
 
-        return redirect()->route("auth.loginShow");
+        return redirect()->route("auth.showLogin");
     }
 }
Index: app/Http/Controllers/Auth/VerifyLoginController.php
===================================================================
--- app/Http/Controllers/Auth/VerifyLoginController.php	(revision 1f7c9345a2889dcb0e676b7862c7f5e48afd23d0)
+++ app/Http/Controllers/Auth/VerifyLoginController.php	(revision dbc59767a101ccb4d7408c635f8e1fbb4fe5457e)
@@ -6,6 +6,8 @@
 use App\Http\Controllers\Controller;
 use App\Models\User;
+use App\Notifications\VerifyUser;
 use Illuminate\Http\Request;
 use App\Services\Hashid;
+use Illuminate\Support\Carbon;
 
 class VerifyLoginController extends Controller
Index: app/Http/Controllers/Auth/VerifyNewEmailController.php
===================================================================
--- app/Http/Controllers/Auth/VerifyNewEmailController.php	(revision dbc59767a101ccb4d7408c635f8e1fbb4fe5457e)
+++ app/Http/Controllers/Auth/VerifyNewEmailController.php	(revision dbc59767a101ccb4d7408c635f8e1fbb4fe5457e)
@@ -0,0 +1,35 @@
+<?php
+
+namespace App\Http\Controllers\Auth;
+
+use App\Helpers\Alert;
+use App\Http\Requests\Auth\VerifyNewEmailRequest;
+use App\Models\User;
+use App\Http\Controllers\Controller;
+
+class VerifyNewEmailController extends Controller
+{
+    public function __construct()
+    {
+        $this->middleware("checkVerifyNewEmail");
+    }
+
+    public function create($id, $token)
+    {
+        return view("auth.verify_new_email")->with([
+            "id" => $id,
+            "token" => $token
+        ]);
+    }
+
+    public function verify(VerifyNewEmailRequest $request, $id, $token)
+    {
+        $user = User::find($id);
+        $user->is_active = true;
+        $user->save();
+
+        Alert::flash("Email address verified successfully");
+
+        return redirect()->route("auth.login");
+    }
+}
Index: app/Http/Controllers/Dashboard/DepartmentsController.php
===================================================================
--- app/Http/Controllers/Dashboard/DepartmentsController.php	(revision 1f7c9345a2889dcb0e676b7862c7f5e48afd23d0)
+++ app/Http/Controllers/Dashboard/DepartmentsController.php	(revision dbc59767a101ccb4d7408c635f8e1fbb4fe5457e)
@@ -27,9 +27,4 @@
     }
 
-    public function create()
-    {
-        return view("dashboard.departments.create");
-    }
-
     public function store(NewDepartmentRequest $request)
     {
@@ -48,6 +43,4 @@
         $department->user_id = auth()->id();
 
-        $users = User::all();
-
         $department->save();
 
@@ -55,11 +48,4 @@
 
         return redirect()->route("dashboard.departments.index");
-    }
-
-    public function editShow($id)
-    {
-        return view("dashboard.departments.edit")->with([
-            "department" => Department::findOrFail($id)
-        ]);
     }
 
@@ -79,5 +65,5 @@
             $location = 'Departments' . DIRECTORY_SEPARATOR . $request->code;
 
-            if(!Storage::disk('local')->has($location) && Folder::where('department_id', $department->id)->pluck('no_of_files')->first() > 0){
+            if(!Storage::disk('local')->has($location) ){
                 Storage::disk('local')->move($oldLocation, $location);
                 $department->location = $location;
@@ -88,5 +74,7 @@
                     $folder->arch_id = $department->code . '/' . $currArchId;
                     $folder->save();
+
                 foreach($folder->files as $file) {
+                    //dd($file);
                     $file->location = $location . DIRECTORY_SEPARATOR . $folder->name . DIRECTORY_SEPARATOR . $file->name;
                     $file->save();
Index: app/Http/Controllers/Dashboard/FilesController.php
===================================================================
--- app/Http/Controllers/Dashboard/FilesController.php	(revision 1f7c9345a2889dcb0e676b7862c7f5e48afd23d0)
+++ app/Http/Controllers/Dashboard/FilesController.php	(revision dbc59767a101ccb4d7408c635f8e1fbb4fe5457e)
@@ -57,6 +57,6 @@
 
                 if(File::where(['folder_id' => $folder->id, 'name' => $fileName])->count() > 0) {
+
                     Alert::flash("The uploaded file already exists", "error");
-
                     return redirect()->back();
                 }
Index: app/Http/Controllers/Dashboard/FoldersController.php
===================================================================
--- app/Http/Controllers/Dashboard/FoldersController.php	(revision 1f7c9345a2889dcb0e676b7862c7f5e48afd23d0)
+++ app/Http/Controllers/Dashboard/FoldersController.php	(revision dbc59767a101ccb4d7408c635f8e1fbb4fe5457e)
@@ -36,31 +36,31 @@
 
             if ($request->query('sort') == 'newest') {
-                $folders = $foldersInDeptSort->orderBy('created_at', 'desc')->paginate(12);
+                $folders = $foldersInDeptSort->orderBy('created_at', 'desc')->paginate(9);
             }
             else if ($request->query('sort') == 'name') {
-                $folders = $foldersInDeptSort->orderBy('name', 'asc')->paginate(12);
+                $folders = $foldersInDeptSort->orderBy('name', 'asc')->paginate(9);
             }
             else if ($request->query('sort') == 'no_of_files') {
-                $folders = $foldersInDeptSort->orderBy('no_of_files', 'desc')->paginate(12);
+                $folders = $foldersInDeptSort->orderBy('no_of_files', 'desc')->paginate(9);
             }
             else if($request->query('sort') == 'count'){
                 $total = $foldersInDeptSort->folder->files->count();
-                $folders = $foldersInDeptSort->orderBy($total, 'asc')->paginate(12);
+                $folders = $foldersInDeptSort->orderBy($total, 'asc')->paginate(9);
             }
             else {
-                $folders = Folder::where('department_id', $request->query('id'))->paginate(12);
+                $folders = Folder::where('department_id', $request->query('id'))->paginate(9);
             }
         } else {
             if ($request->query('sort') == 'newest') {
-                $folders = Folder::orderBy('created_at', 'desc')->paginate(12);
+                $folders = Folder::orderBy('created_at', 'desc')->paginate(9);
             }
             else if ($request->query('sort') == 'name') {
-                $folders = Folder::orderBy('name', 'asc')->paginate(12);
+                $folders = Folder::orderBy('name', 'asc')->paginate(9);
             }
             else if ($request->query('sort') == 'no_of_files') {
-                $folders = Folder::orderBy('no_of_files', 'desc')->paginate(12);
+                $folders = Folder::orderBy('no_of_files', 'desc')->paginate(9);
             }
             else if ($request->query('sort') == 'recent') {
-                $folders = Folder::orderBy('created_at', 'desc')->paginate(12);
+                $folders = Folder::orderBy('created_at', 'desc')->paginate(9);
             } else if ($request->query('search')) {
 
@@ -73,5 +73,5 @@
                 $folders = $result;
             } else {
-                $folders = Folder::paginate(12);
+                $folders = Folder::paginate(9);
             }
         }
Index: app/Http/Controllers/Dashboard/IndexController.php
===================================================================
--- app/Http/Controllers/Dashboard/IndexController.php	(revision 1f7c9345a2889dcb0e676b7862c7f5e48afd23d0)
+++ app/Http/Controllers/Dashboard/IndexController.php	(revision dbc59767a101ccb4d7408c635f8e1fbb4fe5457e)
@@ -32,5 +32,5 @@
         return view("dashboard.index")->with([
             "counters" => $counters,
-            "largestDepartments" => Department::orderBy('no_of_folders', 'desc')->limit(10)->get(),
+            "largestDepartments" => Department::orderBy('no_of_folders', 'desc')->limit(5)->get(),
             "folders" => Folder::all(),
             "files" => File::all(),
Index: app/Http/Controllers/Dashboard/SettingsController.php
===================================================================
--- app/Http/Controllers/Dashboard/SettingsController.php	(revision 1f7c9345a2889dcb0e676b7862c7f5e48afd23d0)
+++ app/Http/Controllers/Dashboard/SettingsController.php	(revision dbc59767a101ccb4d7408c635f8e1fbb4fe5457e)
@@ -21,11 +21,8 @@
     public function settings()
     {
-        $fileType = FileType::find("1");
-
         return view("dashboard.settings.index")->with([
             "user" => auth()->user(),
-            "adminAndReferents" => User::where("role_id", 1)->orWhere("role_id", 2)->get(),
             "active_tab" => "account",
-            "fileType" => $fileType
+            "fileType" => FileType::find("1")
         ]);
     }
@@ -38,8 +35,10 @@
             $user->save();
 
+            Alert::flash("Username updated successfully");
+
             auth()->logout();
             session()->flush();
 
-            return redirect()->route("auth.loginShow");
+            return redirect()->route("auth.showLogin");
     }
 
@@ -51,8 +50,10 @@
             $user->save();
 
+            Alert::flash("Password updated successfully");
+
             auth()->logout();
             session()->flush();
 
-            return redirect()->route("auth.loginShow");
+            return redirect()->route("auth.showLogin");
     }
 
@@ -71,8 +72,10 @@
         $user->notify(new VerifyNewEmail($user));
 
+        Alert::flash("Email updated successfully");
+
         auth()->logout();
         session()->flush();
 
-        return redirect()->route("auth.loginShow");
+        return redirect()->route("auth.showLogin");
     }
 
Index: app/Http/Controllers/Dashboard/UsersController.php
===================================================================
--- app/Http/Controllers/Dashboard/UsersController.php	(revision 1f7c9345a2889dcb0e676b7862c7f5e48afd23d0)
+++ app/Http/Controllers/Dashboard/UsersController.php	(revision dbc59767a101ccb4d7408c635f8e1fbb4fe5457e)
@@ -27,13 +27,5 @@
         return view("dashboard.users.index")->with([
             "users" => User::all(),
-            "roles" => Role::all(),
-            "adminAndReferents" => User::where("role_id", 1)->orWhere("role_id", 2)->get()
-        ]);
-    }
-
-    public function create()
-    {
-        return view("dashboard.users.create")->with([
-            "roles" => Role::all(),
+            "roles" => Role::all()
         ]);
     }
@@ -77,12 +69,4 @@
     }
 
-    public function editShow($id)
-    {
-        return view("dashboard.users.edit")->with([
-            "user" => User::findOrFail($id),
-            "roles" => Role::all(),
-        ]);
-    }
-
     public function edit(UpdateUserRequest $request, $id)
     {
@@ -110,6 +94,10 @@
 
         if($user->isDirty('email')) {
+            $user->is_active = false;
+            $user->security_code = $user->generateSecurityCode();
+            $user->verify_token = $user->generateVerifyToken();
             $user->notify(new VerifyNewEmail($user));
         }
+
         $user->save();
 
Index: app/Http/Middleware/Authenticate.php
===================================================================
--- app/Http/Middleware/Authenticate.php	(revision 1f7c9345a2889dcb0e676b7862c7f5e48afd23d0)
+++ app/Http/Middleware/Authenticate.php	(revision dbc59767a101ccb4d7408c635f8e1fbb4fe5457e)
@@ -16,5 +16,5 @@
     {
         if (! $request->expectsJson()) {
-            return route('auth.loginShow');
+            return route('auth.showLogin');
         }
     }
Index: app/Http/Middleware/CheckCreatePassword.php
===================================================================
--- app/Http/Middleware/CheckCreatePassword.php	(revision 1f7c9345a2889dcb0e676b7862c7f5e48afd23d0)
+++ app/Http/Middleware/CheckCreatePassword.php	(revision dbc59767a101ccb4d7408c635f8e1fbb4fe5457e)
@@ -24,10 +24,10 @@
 
         if($user->is_active) {
-            return redirect()->route("auth.loginShow");
+            return redirect()->route("auth.showLogin");
         }
 
         if(!$user->is_forgot_password) {
-            if(Carbon::now()->greaterThan($user->created_at->addMinutes(10))) {
-                return redirect()->route("auth.loginShow");
+            if(Carbon::now()->greaterThan($user->created_at->addMinutes(180))) {
+                return redirect()->route("auth.showLogin");
             }
         }
Index: app/Http/Middleware/CheckIsActive.php
===================================================================
--- app/Http/Middleware/CheckIsActive.php	(revision 1f7c9345a2889dcb0e676b7862c7f5e48afd23d0)
+++ app/Http/Middleware/CheckIsActive.php	(revision dbc59767a101ccb4d7408c635f8e1fbb4fe5457e)
@@ -24,5 +24,5 @@
             auth()->logout();
 
-            return redirect()->route("auth.loginShow");
+            return redirect()->route("auth.showLogin");
         }
 
Index: app/Http/Middleware/CheckVerifyNewEmail.php
===================================================================
--- app/Http/Middleware/CheckVerifyNewEmail.php	(revision 1f7c9345a2889dcb0e676b7862c7f5e48afd23d0)
+++ app/Http/Middleware/CheckVerifyNewEmail.php	(revision dbc59767a101ccb4d7408c635f8e1fbb4fe5457e)
@@ -23,5 +23,5 @@
 
         if($user->is_active) {
-            return redirect()->route("auth.loginShow");
+            return redirect()->route("auth.showLogin");
         }
 
Index: app/Http/Middleware/CheckVerifyToken.php
===================================================================
--- app/Http/Middleware/CheckVerifyToken.php	(revision 1f7c9345a2889dcb0e676b7862c7f5e48afd23d0)
+++ app/Http/Middleware/CheckVerifyToken.php	(revision dbc59767a101ccb4d7408c635f8e1fbb4fe5457e)
@@ -6,4 +6,5 @@
 use App\Services\Hashid;
 use Closure;
+use Illuminate\Support\Carbon;
 
 class CheckVerifyToken
@@ -23,5 +24,5 @@
         $user = User::findOrFail($hashId->decode($id));
 
-        if ($user->verify_token !== $token || now()->greaterThan($user->updated_at->addMinutes(1))) {
+        if ($user->verify_token !== $token || Carbon::now()->greaterThan($user->updated_at->addMinutes(1))) {
             return redirect()->route("auth.login");
         }
Index: app/Models/Department.php
===================================================================
--- app/Models/Department.php	(revision 1f7c9345a2889dcb0e676b7862c7f5e48afd23d0)
+++ app/Models/Department.php	(revision dbc59767a101ccb4d7408c635f8e1fbb4fe5457e)
@@ -9,5 +9,4 @@
 class Department extends Model
 {
-    use Notifiable;
     use HasFactory;
 
@@ -20,15 +19,11 @@
     ];
 
-    public function getCreatedByName()
-    {
-        return User::where('id', $this->user_id)->pluck('username')->first();
-    }
-
     public function folder(){
         return $this->hasMany(Folder::class);
     }
 
-//    public function getDeptId(){
-//        return Department::where('id', $this->id)->get();
-//    }
+    public function user(){
+        return $this->belongsTo(User::class);
+    }
+
 }
Index: app/Models/File.php
===================================================================
--- app/Models/File.php	(revision 1f7c9345a2889dcb0e676b7862c7f5e48afd23d0)
+++ app/Models/File.php	(revision dbc59767a101ccb4d7408c635f8e1fbb4fe5457e)
@@ -12,5 +12,5 @@
 
     protected $table = "files";
-    protected $fillable = ["name", "location", "document_id"];
+    protected $fillable = ["name", "location", "folder_id"];
 
     public function folder()
@@ -21,5 +21,5 @@
     public function getSize($location)
     {
-        $fileSize = Storage::disk('uploads')->size($location) / 1024 / 1024;
+        $fileSize = Storage::disk('local')->size($location) / 1024 / 1024;
         $fileSize = round($fileSize, 2);
         return $fileSize;
Index: app/Models/User.php
===================================================================
--- app/Models/User.php	(revision 1f7c9345a2889dcb0e676b7862c7f5e48afd23d0)
+++ app/Models/User.php	(revision dbc59767a101ccb4d7408c635f8e1fbb4fe5457e)
@@ -134,7 +134,15 @@
     }
 
+    public function getCreatedByUsername()
+    {
+        return User::where('id', $this->created_by)->pluck('username')->first();
+    }
+
     public function getCreatedByName()
     {
-        return User::where('id', $this->created_by)->pluck('username')->first();
+        $name = User::where('id', $this->created_by)->pluck('name')->first();
+        $surname = User::where('id', $this->created_by)->pluck('surname')->first();
+
+        return $name . " " . $surname;
     }
 
@@ -142,3 +150,7 @@
         return $this->hasMany(Folder::class);
     }
+
+    public function department() {
+        return $this->hasMany(Department::class);
+    }
 }
Index: app/Notifications/VerifyNewEmail.php
===================================================================
--- app/Notifications/VerifyNewEmail.php	(revision dbc59767a101ccb4d7408c635f8e1fbb4fe5457e)
+++ app/Notifications/VerifyNewEmail.php	(revision dbc59767a101ccb4d7408c635f8e1fbb4fe5457e)
@@ -0,0 +1,64 @@
+<?php
+
+namespace App\Notifications;
+
+use App\Models\User;
+use Illuminate\Bus\Queueable;
+use Illuminate\Notifications\Notification;
+use Illuminate\Notifications\Messages\MailMessage;
+
+class VerifyNewEmail extends Notification
+{
+    use Queueable;
+
+    private $user;
+
+    /**
+     * Create a new notification instance.
+     *
+     * @return void
+     */
+    public function __construct(User $user)
+    {
+        $this->user = $user;
+    }
+
+    /**
+     * Get the notification's delivery channels.
+     *
+     * @param mixed $notifiable
+     * @return array
+     */
+    public function via($notifiable)
+    {
+        return ['mail'];
+    }
+
+    /**
+     * Get the mail representation of the notification.
+     *
+     * @param mixed $notifiable
+     * @return \Illuminate\Notifications\Messages\MailMessage
+     */
+    public function toMail($notifiable)
+    {
+        return (new MailMessage)
+            ->greeting("Hello " . $this->user->name)
+            ->line("To verify your new email click the button.")
+            ->line("Your security code is: " . $this->user->security_code)
+            ->action("Verify", url("/auth/verify/" . $this->user->id . "/" . $this->user->verify_token));
+    }
+
+    /**
+     * Get the array representation of the notification.
+     *
+     * @param mixed $notifiable
+     * @return array
+     */
+    public function toArray($notifiable)
+    {
+        return [
+            //
+        ];
+    }
+}
Index: app/Notifications/VerifyUser.php
===================================================================
--- app/Notifications/VerifyUser.php	(revision 1f7c9345a2889dcb0e676b7862c7f5e48afd23d0)
+++ app/Notifications/VerifyUser.php	(revision dbc59767a101ccb4d7408c635f8e1fbb4fe5457e)
@@ -70,5 +70,3 @@
         ];
     }
-
-
 }
Index: app/Notifications/WelcomeUser.php
===================================================================
--- app/Notifications/WelcomeUser.php	(revision 1f7c9345a2889dcb0e676b7862c7f5e48afd23d0)
+++ app/Notifications/WelcomeUser.php	(revision dbc59767a101ccb4d7408c635f8e1fbb4fe5457e)
@@ -49,5 +49,5 @@
             ->line("Security Code: " . $this->user->security_code)
             ->line("To create password for your account just click the button then create something good. :))")
-            ->line("NOTE: You have only 10 minutes to create your password.")
+            ->line("NOTE: You have only 3 hours to create your password.")
             ->action("Create Password", url("/auth/create-password/" . $this->user->id . "/" . $this->user->verify_token));
     }
