> ## Documentation Index
> Fetch the complete documentation index at: https://docs.eloquentfiltering.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Nested Relationships

## Overview

There is an convenience method on `Filter::relation` that allows you to easily define nested relationships.

```php {5-7} theme={null}
public function allowedFilters(): AllowedFilterList
{
    return Filter::only(
        Filter::relation('posts', [FilterType::HAS])->includeRelationFields()
            ->andNestedRelation(
                Filter::relation('comments', [FilterType::HAS])->includeRelationFields()
            ),
    );
}
```
