Ok. So I am working on a website using CI. Here is the structure of my controller:
class MY_Controller extends Controller class User extends MY_Controller class User_Model
So, I load the User_Model inside the constructor of the User controller. I know that it is loaded properly because I tried to print something from User_Model and it worked just fine. However, when I use one of the functions in the User_Model from User controller, it started giving me the error. This is the error I received:
"Undefined property: User::$User_Model"
Anybody has any idea?
This is extended controller
class MY_Controller extends Controller {
public function __construct() {
parent::Controller();
}
}
This is the controller
class User extends MY_Controller {
public function __construct() {
parent::__construct();
$this->load->model('user_model');
echo $this->user_model->validate_user('hartantothio');
}
}
This is the User_model
class User_model extends Model {
public function __construct() {
parent::Model();
}
public function validate_user($user, $pass = '') {
return '123';
}
}