execute($audit); } /** * Log model update * * @param int $account Account who created the model * @param mixed $old Old value * @param mixed $new New value * @param int $type Module model type * @param string $trigger What triggered this log? * @param string $module Module name * @param string $ref Reference to other model * @param string $content Message * @param string $ip Ip * * @return void * * @api * * @since 1.0.0 */ public function eventLogUpdate( int $account, mixed $old, mixed $new, int $type = 0, string $trigger = '', string $module = null, string $ref = null, string $content = null, string $ip = null ) : void { $oldString = StringUtils::stringify($old, \JSON_PRETTY_PRINT); $newString = StringUtils::stringify($new, \JSON_PRETTY_PRINT); if ($oldString === $newString) { return; } $audit = new Audit( new NullAccount($account), $oldString, $newString, $type, $trigger, $module, $ref, $content, (int) \ip2long($ip ?? '127.0.0.1') ); AuditMapper::create()->execute($audit); } /** * Log model delete * * @param int $account Account who created the model * @param mixed $old Old value * @param mixed $new New value (always null) * @param int $type Module model type * @param string $trigger What triggered this log? * @param string $module Module name * @param string $ref Reference to other model * @param string $content Message * @param string $ip Ip * * @return void * * @api * * @since 1.0.0 */ public function eventLogDelete( int $account, mixed $old, mixed $new, int $type = 0, string $trigger = '', string $module = null, string $ref = null, string $content = null, string $ip = null ) : void { $oldString = StringUtils::stringify($old, \JSON_PRETTY_PRINT); $audit = new Audit( new NullAccount($account), $oldString, null, $type, $trigger, $module, $ref, $content, (int) \ip2long($ip ?? '127.0.0.1') ); AuditMapper::create()->execute($audit); } }