hooks not working please check
hi
I want to check dependency from other table entry of an module before deleting its entry ..
so if their is no entry for this module exists it allow it to delete else cant be deleted
i have done following things :
model name : Jobs_model
config->hooks.php
$hook['before_delete_jobs'] = array(
'class' => 'job_hooks',
'function' => 'before_delete_jobs',
'filename' => 'Job_hooks.php',
'filepath' => 'hooks',
'params' => array(),
'module' => 'job');
hooks -> Job_hooks.php
class Job_hooks extends CI_Controller {
public function __construct()
{
parent::__construct(); // table name
}
function before_delete_jobs($where)
{
print_r($where); return FALSE;die(); //just to prevent from getting deleted implement the thing later
}
}
but the function did not executing or if executed have no effect
is their any mistake ??? or have other simple way please check
Comments
instead on my Jobs_model
"on_before_delete" function is working
public function on_before_delete($values)
{
print_r($values);
//die();
return FALSE;
}
but if i remove the die statement it is still removing the entry .. is their a way to stop it
instead of redirecting it .
https://codeigniter.com/user_guide/general/hooks.html
$hook['before_delete_jobs'] = array( 'class' => 'Job_hooks', 'function' => 'before_delete_jobs', 'filename' => 'Job_hooks.php', 'filepath' => 'hooks', 'params' => array() );