Reputation:
I created a model called Model_base extending from ci_model and added all common functions inside it
class Model_base extends CI_Model {
function __construct()
{
parent::__construct();
}
function create() {
//do insert data into database
}
function read() {
//do get data into database
}
function update() {
//do update data into database
}
function delete() {
//do delete data from database
}
}
Now I want to create a new model with extending base_model is it possible in CodeIgniter
Upvotes: 7
Views: 5662
Reputation: 11588
Create a new model PHP file, and use:
class Model_New extends Model_Base {
public function __construct()
{
parent::__construct();
}
}
Upvotes: 2
Reputation: 8415
Yes, you can, just remember to call the parent::__construct();
in the constructor
of your new Model.
Upvotes: 0