Illuminate\Database\Eloquent\Builder::callScope PHP Метод

callScope() защищенный Метод

Apply the given scope on the current builder instance.
protected callScope ( callable $scope, array $parameters = [] ) : mixed
$scope callable
$parameters array
Результат mixed
    protected function callScope(callable $scope, $parameters = [])
    {
        array_unshift($parameters, $this);
        $query = $this->getQuery();
        // We will keep track of how many wheres are on the query before running the
        // scope so that we can properly group the added scope constraints in the
        // query as their own isolated nested where statement and avoid issues.
        $originalWhereCount = count($query->wheres);
        $result = call_user_func_array($scope, $parameters) ?: $this;
        if ($this->shouldNestWheresForScope($query, $originalWhereCount)) {
            $this->nestWheresForScope($query, $originalWhereCount);
        }
        return $result;
    }