Jump to content


Member Since 02 Aug 2018
Offline Last Active Aug 15 2018 08:11 PM

Topics I've Started

Additional Information in n2n

04 August 2018 - 10:26 PM

Hi All,


I just started using Grocery CRUD Enterprise with CodeIgnitor and I love it. First of all thanks for creating this awesome lib.


I successfully created a n2n relationship which is working great. But I would need to add some more information to the junctionTable. Its a connection between a user and a crew table where a crew can has multiple user or a user can has multiple crews. What I need to add is a timeframe from when to when the user will be on this crew, I already created two field "userincrew_from" and "userincrew_to".


Is there any way to let the user fill in those two information while editing the db entry?

$crud = $this->_getGroceryCrudEnterprise();
$crud->setSubject('Crew', 'Crews');
$crud->columns(['crew_name', 'company_id', 'user_id_crewboss', 'user_id_cook', 'user_id_geo', 'crewmember']);
$crud->displayAs('crew_name', 'Crewname');
$crud->displayAs('company_id', 'Company');
$crud->displayAs('user_id_crewboss', 'Crewboss');
$crud->displayAs('user_id_cook', 'Cook');
$crud->displayAs('user_id_geo', 'Geologist');
$crud->setRelation('company_id', 'Company', 'company_shortcut');
$crud->setRelation('user_id_crewboss', 'Users', '{user_firstname} {user_lastname}');
$crud->setRelation('user_id_cook', 'Users', '{user_firstname} {user_lastname}');
$crud->setRelation('user_id_geo', 'Users', '{user_firstname} {user_lastname}');
$crud->setRelationNtoN('crewmember', 'User_to_Crew', 'Users', 'crew_id', 'user_id', '{user_firstname} {user_lastname}');
$output = $crud->render();
$page = $page."/crews";

Thanks so much for you help,