List of all Users belonging to Company?

2013-12-26 Thread David Deley
I have a Model of Users, and a Model of Companies each User belongs to a Company: public $belongsTo = 'Company'; each Company has many Users: public $hasMany = 'User'; A user logs in. It's an ordinary user (not an administrator). I'm in the UsersController.php, function index, and I want

Re: List of all Users belonging to Company?

2013-12-26 Thread CrotchFrog
Set up your paginate just as you would a normal search using the logged in users 'company_id' as the search criteria. $this-paginate = array( 'conditions' = array( 'User.company_id' = $this-Auth-user('company_id'))); $this-set('users', $this-Paginator-paginate()); I believe that