/** * Log some write operation to the database. */ protected function logWrite($action, $payload = array()) { Event::info(array('event' => 'sparkrecord.write', 'type' => get_class($this), 'id' => $this->getId(), 'action' => $action, 'payload' => $payload)); if (defined('\\FLAG_NOTIFY') && constant('\\FLAG_NOTIFY')) { $dino_name = get_class($this); if (\Spark\Notify::validDino($dino_name)) { $payload = array('id' => $this->getId(), 'record' => $this->getRecord(), 'changes' => $this->changes(), 'originalValues' => $this->originalValues()); \Spark\Notify::emit($dino_name, $action, $payload); } } }