Mpociot\Versionable\Version::diff PHP Method

diff() public method

If no version is provided, it will be diffed against the current version.
public diff ( Version $againstVersion = null ) : array
$againstVersion Version
return array
    public function diff(Version $againstVersion = null)
    {
        $model = $this->getModel();
        $diff = $againstVersion ? $againstVersion->getModel() : $this->versionable()->withTrashed()->first()->currentVersion()->getModel();
        $diffArray = array_diff_assoc($diff->getAttributes(), $model->getAttributes());
        if (isset($diffArray[$model->getCreatedAtColumn()])) {
            unset($diffArray[$model->getCreatedAtColumn()]);
        }
        if (isset($diffArray[$model->getUpdatedAtColumn()])) {
            unset($diffArray[$model->getUpdatedAtColumn()]);
        }
        if (method_exists($model, 'getDeletedAtColumn') && isset($diffArray[$model->getDeletedAtColumn()])) {
            unset($diffArray[$model->getDeletedAtColumn()]);
        }
        return $diffArray;
    }