public static function install()
 {
     if (InstallerModel::databaseLocked()) {
         View::load("install/database_locked.twig");
     } else {
         if (empty($_POST)) {
             View::load("install/install.twig", ["checks" => InstallerModel::checkRequirements()]);
         } else {
             InstallerModel::installDatabase(true);
             $adminGroupId = current(UserGroup::get(null, "Root Admin"))->id;
             User::add($_POST["email"], $_POST["full-name"], $_POST["phone-number"], $_POST["password"], $adminGroupId);
             View::load("install/complete.twig");
         }
     }
 }
 public static function add()
 {
     Controller::requirePermissions(["AdminAccessDashboard", "AdminUsers"]);
     Controller::requireFields("post", ["email", "password", "full-name", "phone-number", "group", "organization"], "/acp/user");
     if (count(UserModel::get(null, $_POST["email"])) > 0) {
         Controller::addAlert(new Alert("danger", "Email is already registered, please use a different one and try again."));
         Controller::redirect("/acp/user");
     }
     try {
         UserModel::add($_POST["email"], $_POST["full-name"], $_POST["phone-number"], $_POST["password"], $_POST["group"], $_POST["organization"]);
     } catch (EmailAddressAlreadyRegisteredException $e) {
         Controller::addAlert(new Alert("danger", "Email is already registered, please use a different one and try again."));
         Controller::redirect("/acp/user");
     }
     Controller::addAlert(new Alert("success", "User added successfully"));
     Controller::redirect("/acp/user");
 }