Lookitsatravis\Listify\Listify::hasScopeChanged PHP Method

hasScopeChanged() private method

Returns whether the scope has changed during the course of interaction with the model
private hasScopeChanged ( ) : boolean
return boolean
    private function hasScopeChanged()
    {
        $theScope = $this->scopeName();
        if (is_string($theScope)) {
            if (!$this->stringScopeValue) {
                $this->stringScopeValue = $theScope;
                return FALSE;
            }
            return $theScope != $this->stringScopeValue;
        }
        $reflector = new \ReflectionClass($theScope);
        if ($reflector->getName() == 'Illuminate\\Database\\Eloquent\\Relations\\BelongsTo') {
            $originalVal = $this->getOriginal()[$theScope->getForeignKey()];
            $currentVal = $this->getAttribute($theScope->getForeignKey());
            if ($originalVal != $currentVal) {
                return TRUE;
            }
        } else {
            if ($reflector->getName() == 'Illuminate\\Database\\Query\\Builder') {
                if (!$this->stringScopeValue) {
                    $this->stringScopeValue = $this->getConditionStringFromQueryBuilder($theScope);
                    return FALSE;
                }
                $theQuery = $this->getConditionStringFromQueryBuilder($theScope);
                if ($theQuery != $this->stringScopeValue) {
                    return TRUE;
                }
            }
        }
        return FALSE;
    }