Back to UserGroupsHelper class

Method total

public int
total
()
Get total available user groups in database.
Returns
  • int
Since
  • 3.6.3

Method total - Source code

/**
 * Get total available user groups in database.
 *
 * @return  integer
 *
 * @since   3.6.3
 */
public function total()
{
    if ($this->total === null) {
        $db = Factory::getDbo();
        $query = $db->getQuery(true)->select('COUNT(' . $db->quoteName('id') . ')')->from($db->quoteName('#__usergroups'));
        $db->setQuery($query);
        $this->total = (int) $db->loadResult();
    }
    return $this->total;
}