public function afterSave($insert, $changedAttributes) { parent::afterSave($insert, $changedAttributes); // when insert false, then record has been updated if (!$insert) { // add StatusLog entry $status_log = new StatusLog(); $status_log->status_id = $this->id; $status_log->updated_by = $this->updated_by; $status_log->created_at = time(); $status_log->save(); } }