Skip to content

siblings() relationship #613

Open
Open
@ven0ms99

Description

@ven0ms99

I migrated from laravel-adjacency-list due to the read-performance benefits. However, I am missing some relations, especially the siblings() relationship.

I know I can simply get the siblings, but I need to get them in a whereHas() relation.

For now, I am using both packages at the same time, which really isn't ideal and also only works, because they both offer a siblings() method:

use NodeTrait, HasAdjacencyList {
        NodeTrait::descendants insteadof HasAdjacencyList;
        NodeTrait::parent insteadof HasAdjacencyList;
        NodeTrait::ancestors insteadof HasAdjacencyList;
        NodeTrait::children insteadof HasAdjacencyList;
        NodeTrait::newCollection insteadof HasAdjacencyList;
        NodeTrait::newEloquentBuilder insteadof HasAdjacencyList;
        NodeTrait::isChildOf insteadof HasAdjacencyList;

        HasAdjacencyList::siblings insteadof NodeTrait;
        HasAdjacencyList::siblingsAndSelf insteadof NodeTrait;
    }

I tried to implement the siblings() relationship myself, but I didn't manage to do it. Maybe someone else with more experience can charm in. Would be highly appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions