Hooks are the functions that we can call before and after doing any task in Models ( database related ). Like after finding data, before saving data etc.
e.g beforeSave(), afterSave(), beforeFind(), afterFind() etc.
<?php
class Classname extends AppModel {
var $name = "Classname";
public function beforeSave(){
// your code
}
public function afterSave(){
// your code
}
}
?>
0 Comment(s)