Codeigniter4 How can i use different field for save() method as primary key |
Dear Friends,
I have a application where HR department can upload a xlsx file to add/update employees records. In the employees table i have id as primary key which i used for other operations like edit, delete etc... For this xlsx file upload functionality i need to use save() method after parsing the data from the file for that i cannot let HR to specify a primary key, instead of that there is one field called "emp_code", how i can use that field as primary key only for the save() method after processing the uploaded xlsx file ? Here is my controller where i process the xlsx file : Code: $data_to_save = [ In model i changed primaryKey = "emp_code" but that works for my save but that stops the other functions like edit and delete. (03-21-2024, 03:22 AM)sarath_unrelax Wrote: Dear Friends, can you please read here carefully please https://codeigniter.com/user_guide/tutor...ews-method you will see that instead of the primary key yet, we can update or delete the data as you wish Codeigniter First, Codeigniter Then You!!
yekrinaDigitals
|
Welcome Guest, Not a member yet? Register Sign In |