I have a table where users log in and add records and i want them to see only what they added. For the filters i use the code :
$user = $this->ion_auth->user()->row();
if ($user->id == '1')
{
$crud->where('cod_id','1');
}
elseif ($user->id == '2')
{
$crud->where('cod_id','2');
}
... where cod_id is the id from user. Now the hard part for me is to add the id automatic when a user adds records to the table. Any ideas ? how can i insert the user id from the users to the cod_id of my table ..
Thanks for you help if anyone know how to do it.