This is a bit difficult to explain. We are using Ion Auth and GC on a new CI project. We have a simple form that allows an admin to create a record by entering a name and selecting an owner. The relation currently looks like this:
$crud->set_relation('owner_id','users','email');
The problem is that this is showing ALL of the users in from the users table. We need to filter the dropdown to show only users where the user belongs to user group ID 10. The users-->groups associations are stored in users_groups which has columns for user_id and group_id;
So basically for the relation, we need it to show users.email where users.id is in (SELECT user_id FROM users_groups WHERE group_id=10).
How can we accomplish this in GC? I believe we might have to use a custom model to do this, but I'm having trouble understanding how to implement it.
Thanks in advance.