public function scopeWithRelations(Builder $builder, $relations = null)
    {
        $with = [];
        foreach ($this->getWithRelationsList($relations) as $relation) {
            list($relation, $scope) = $this->_parseRelation($relation);

            if ($this->isWithableRelation($builder, $relation)) {
                if ($scope) {
                    $with[$relation] = function ($query) use ($scope) {
                        $query->$scope();
                    };
                } else {
                    $with[] = $relation;
                }
            }
        }
        $builder->with($with);
    }