且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用form_dropdown在Ion Auth中创建用户时,将用户添加到组中

更新时间:2022-02-05 07:47:21

我是在 ion_auth_model.php

/**
 * group list
 *
 * @return array
 * @author Susilo N
 **/
public function grouplist()
{
    $query = $this->db->get('groups');

    foreach ($query->result() as $row)
            {
                  $listArray[$row->id] = $row->name;                
            }               

    return $listArray;
}

然后我在控制器上添加它

then I add this at controller

$this->data["listGroups"] = $this->ion_auth->grouplist();

并在视图中

<?= form_dropdown('groups', $listGroups, '1') ?>