开发者

CakePHP admin index

I have a开发者_StackOverflown admin panel where I would like to filter users by groups..

Group 1 has

- User 1

- User 2

- User 3

Group 2 has

- User 6

- User 4

- User 9

How can I make a find method and fiter users by groups.

function admin_index() {

    // This function get al the users I want to filter by groups
    $this->set('users', $this->User->find('all'));

}


Try something like this:

$this->Users->find('all',array('conditions'=>
                       array('Group.name IN'=>array('Group1','Group2','Group3'))
              )
);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜