开发者

CakePHP admin index

开发者 https://www.devze.com 2023-03-05 06:35 出处:网络
I have a开发者_StackOverflown admin panel where I would like to filter users by groups.. Group 1 has

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

精彩评论

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