/ / insert
public function charu ($data)
{
return $this->insert($data);
}
changed to
/ / insert
public function charu ($data)
{
return $this->data($data)->save();
}
try it?
when you directly call the insert () method, you call the Model class, the parent class of the User class, but the Model class does not have this method, so you execute the _ _ Call method inside, pointing to the Query class (which does not bind your events). If you want to trigger the events on the User class, you must call the methods specified in the Model class to add, delete, modify and check these methods
.
didn't read the comments in the model event, did you? Didn't take a cursory look at the code, did you? Use the method in the model to insert and delete the data to trigger this model event, such as the save,delete method. But is the insert method an operation in the model? Methods in the db class do not trigger model events