public function update()
    {
        $this->apply(function ($config) {
            $foreignKey = snake_case($this->key($config['foreignKey']));
            $amount = $this->model->{$config['columnToSum']};

            if ($this->model->getOriginal($foreignKey) && $this->model->{$foreignKey} != $this->model->getOriginal($foreignKey)) {
                $this->updateCacheRecord($config, '-', $amount, $this->model->getOriginal($foreignKey));
                $this->updateCacheRecord($config, '+', $amount, $this->model->{$foreignKey});
            }
        });
    }
public function update()
    {
        $this->apply(function ($config) {
            $foreignKey = snake_case($this->key($config['foreignKey']));
            $amount = $this->model->{$config['columnToSum']};

            if ($this->model->getOriginal($foreignKey) && $this->model->{$foreignKey} != $this->model->getOriginal($foreignKey)) {
                $this->updateCacheRecord($config, '-', $amount, $this->model->getOriginal($foreignKey));
                $this->updateCacheRecord($config, '+', $amount, $this->model->{$foreignKey});
            }
        });
    }
public function update ( ) { $ this -> apply ( function ( $ config ) { $ foreignKey = snake_case ( $ this -> key ( $ config [ 'foreignKey' ] ) ) ; $ amount = $ this -> model -> { $ config [ 'columnToSum' ] } ; if ( $ this -> model -> getOriginal ( $ foreignKey ) && $ this -> model -> { $ foreignKey } != $ this -> model -> getOriginal ( $ foreignKey ) ) { $ this -> updateCacheRecord ( $ config , '-' , $ amount , $ this -> model -> getOriginal ( $ foreignKey ) ) ; $ this -> updateCacheRecord ( $ config , '+' , $ amount , $ this -> model -> { $ foreignKey } ) ; } } ) ; }
Update the cache for all operations.
Update the cache for all operations .