<?php

declare(strict_types=1);

namespace Builder\Core\Foundation\Concerns;

use Staudenmeir\LaravelAdjacencyList\Eloquent\HasRecursiveRelationships;

/**
 * Adds efficient recursive parent-child traversal to an Eloquent model via CTEs.
 *
 * Requires a `parent_id` column (nullable FK to the same table) and the
 * staudenmeir/laravel-adjacency-list package as a Composer dependency.
 *
 * Provides: parent(), children(), ancestors(), descendants(), ancestorsAndSelf(), depth.
 * All recursive relationships are resolved with a single CTE query (no N+1).
 */
trait HasHierarchy
{
    use HasRecursiveRelationships;
}
