BaseController load, use model example |
I have a model that performs some operations in my database. We'll call it "Somemodel". There's a method I want to use called "somemethod($value)" in the Somemodel model. I'd like to include this model and call that method in every controller. I know that I can modify the BaseController, and all my controllers should extend BaseController. Can someone show me an example of what that looks like? The documentation shows using a Session service. So, what does the code look like to load one of my models?
Code: // Do Not Edit This Line
There is a helper that you can use that makes it a lot simpler.
PHP Code: // Create a new class manually CodeIgniter 4 User Guide - Using CodeIgniter’s Model What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Thank you, InsiteFX! That was exactly what I needed.
(I tried to "+Rate" your post, but Chrome wouldn't have it). I greatly appreciate your response. |
Welcome Guest, Not a member yet? Register Sign In |