codeigniter-base-model
codeigniter-base-model copied to clipboard
set callback option from controller
trafficstars
there should be option to set callbacks from controller all before, after variables are protected we can not set them from controller there should be set_callback function to set before or after callbacks with type
$this->child_model->set_callback('before_get','test1');
so we will not duplicate model right now if you set any callback for example before_get will be called for all getting records
class child_model extend MY_Model
{
protected $before_get = array('test');
}
or for sprecific get we have to do this
class child_model extend MY_Model
{
function get_all()
{
$this->before_get = array('test');
return parent::get_all();
}
function get()
{
$this->before_get = array('test1');
return parent::get();
}
}
i did some setting callbacks from controller
http://scrp.at/bz7
looking some more better option
Inside of your controller, why not use $this->child_model->trigger('before_get') ?