Eloquent\Dialect\Json::getDirty PHP Method

getDirty() public method

Add json attributes to the list of things that have changed (when they've changed).
public getDirty ( $includeJson = false ) : array
return array
    public function getDirty($includeJson = false)
    {
        $dirty = parent::getDirty();
        if (!$includeJson) {
            return $dirty;
        }
        foreach (array_unique($this->jsonAttributes) as $attribute) {
            $originals[$attribute] = json_decode(array_get($this->original, $attribute, 'null'), true);
        }
        foreach ($this->jsonAttributes as $jsonAttribute => $jsonColumn) {
            if ($this->{$jsonAttribute} !== null && $this->{$jsonAttribute} !== array_get($originals[$jsonColumn], $jsonAttribute)) {
                $dirty[$jsonAttribute] = json_encode($this->{$jsonAttribute});
            }
        }
        return $dirty;
    }