Posts: 42
Threads: 9
Joined: Oct 2019
Reputation:
-1
09-02-2020, 09:11 AM
(This post was last modified: 09-02-2020, 09:12 AM by Goddard.)
I am using CI 3. In CI 3 all the models use either $this->db->query, $this->db->insert, $this->db->update, or $this->db->delete.
Sorry I am not understanding what you mean by just put it in MY_Model. Put everything in how?
Thanks for elaborating.
Posts: 4,363
Threads: 101
Joined: Oct 2014
Reputation:
146
You create a MY_Model in ./application/core/MY_Model.php which extends CodeIgniters CI_Model.
Now you add all your own methods that you want to reuse to the MY_Model.
You then extend all of your new models form the MY_Model.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Posts: 42
Threads: 9
Joined: Oct 2019
Reputation:
-1
This requires modifying all 150 models that already exist.
This also ignores the fact many of the models may have different named functions for different operations.
Am I missing something, but what you said still isn't enough information.
This is an existing project and not a new project.
Posts: 4,363
Threads: 101
Joined: Oct 2014
Reputation:
146
Then all I can say is that the project was not scoped out in the beginning the correct way.
You only have to options the one you talk about or a new MY_Model.
You would only need to do a search and replace on 150 models using search for extend CI_Model
and replace with MY_Model.
Or your way try to hack the CI query which if you read up on it the database is not extendable.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Posts: 137
Threads: 20
Joined: Jun 2015
Reputation:
0
09-14-2020, 05:44 PM
(This post was last modified: 09-14-2020, 05:51 PM by nc03061981.)
I have one idea
1. Save user actions in text file (create a helper function to save actions to text file: helper_logs_user_actions($user, $action) and call when user have action
2. Using Cronjob save from text file to database after 1 hour, 2 hours... belong to num rows,...
Can or not?
Learning CI4 from my works, from errors and how to fix bugs in the community
Love CI & Thanks CI Teams
Posts: 4,363
Threads: 101
Joined: Oct 2014
Reputation:
146
09-28-2020, 11:03 AM
(This post was last modified: 09-28-2020, 11:04 AM by InsiteFX.)
If he is running CodeIgniter 4 he can use Events. Events are like hooks in CI4.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )