public function revisionLog($action, $table, $id, array $old = [], array $new = [], $user = null)
    {
        $user = $this->parseUser($user);

        $connection = $this->getCurrentConnection();

        $format = $connection->getQueryGrammar()->getDateFormat();

        $connection->table($this->table)->insert([
            'action' => substr($action, 0, 255),
            'table_name' => substr($table, 0, 255),
            'row_id' => substr($id, 0, 255),
            'old' => json_encode($old),
            'new' => json_encode($new),
            'user' => substr($user, 0, 255),
            'ip' => substr($this->getFromServer('REMOTE_ADDR'), 0, 255) ?: null,
            'ip_forwarded' => substr($this->getFromServer('HTTP_X_FORWARDED_FOR'), 0, 255) ?: null,
            'created_at' => (new DateTime())->format($format),
        ]);

        $this->resetConnection();
    }
public function revisionLog($action, $table, $id, array $old = [], array $new = [], $user = null)
    {
        $user = $this->parseUser($user);

        $connection = $this->getCurrentConnection();

        $format = $connection->getQueryGrammar()->getDateFormat();

        $connection->table($this->table)->insert([
            'action' => substr($action, 0, 255),
            'table_name' => substr($table, 0, 255),
            'row_id' => substr($id, 0, 255),
            'old' => json_encode($old),
            'new' => json_encode($new),
            'user' => substr($user, 0, 255),
            'ip' => substr($this->getFromServer('REMOTE_ADDR'), 0, 255) ?: null,
            'ip_forwarded' => substr($this->getFromServer('HTTP_X_FORWARDED_FOR'), 0, 255) ?: null,
            'created_at' => (new DateTime())->format($format),
        ]);

        $this->resetConnection();
    }
public function revisionLog ( $ action , $ table , $ id , array $ old = [ ] , array $ new = [ ] , $ user = null ) { $ user = $ this -> parseUser ( $ user ) ; $ connection = $ this -> getCurrentConnection ( ) ; $ format = $ connection -> getQueryGrammar ( ) -> getDateFormat ( ) ; $ connection -> table ( $ this -> table ) -> insert ( [ 'action' => substr ( $ action , 0 , 255 ) , 'table_name' => substr ( $ table , 0 , 255 ) , 'row_id' => substr ( $ id , 0 , 255 ) , 'old' => json_encode ( $ old ) , 'new' => json_encode ( $ new ) , 'user' => substr ( $ user , 0 , 255 ) , 'ip' => substr ( $ this -> getFromServer ( 'REMOTE_ADDR' ) , 0 , 255 ) ? : null , 'ip_forwarded' => substr ( $ this -> getFromServer ( 'HTTP_X_FORWARDED_FOR' ) , 0 , 255 ) ? : null , 'created_at' => ( new DateTime ( ) ) -> format ( $ format ) , ] ) ; $ this -> resetConnection ( ) ; }
Log data revisions in the db.

@param string $action
@param string $table
@param int    $id
@param array  $old
@param array  $new
@param string $user
Log data revisions in the db .