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'))
)
);
精彩评论