/** * @param $username * @param $password * @param $isadmin * @param $permissions * @return bool|int Returns false on an unexpected failure, returns -1 if the a unique constraint in the database fails, or the new rows id and uuid and uuid if the insert is successful */ public function create($username, $password, $isadmin, $permissions) { $uuid = uniqid(); $sql = "INSERT INTO auth (username, password, uuid, admin, permissions) VALUES (:username,:password,:uuid,:isadmin,:perm)"; $placeholders = [':username' => $username, ':password' => $password, ':uuid' => $uuid, ':isadmin' => $isadmin, ':perm' => $permissions]; $result = parent::insert($sql, $placeholders); if ($result && $result > 0) { return ['id' => $result, 'uuid' => $uuid]; } else { return $result; } }