From b3d061bb98e69098d03a5800829631d9afd5733a Mon Sep 17 00:00:00 2001 From: Ryan Chandler Date: Wed, 24 Jan 2024 16:43:41 +0000 Subject: [PATCH] Forms/Docs: Add documentation for new ignoreRecord argument --- packages/forms/docs/03-fields/03-select.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/forms/docs/03-fields/03-select.md b/packages/forms/docs/03-fields/03-select.md index b4b3e8cf58..f2e6565cab 100644 --- a/packages/forms/docs/03-fields/03-select.md +++ b/packages/forms/docs/03-fields/03-select.md @@ -204,6 +204,19 @@ Select::make('author_id') ->preload() ``` +### Excluding the current record + +When working with recursive relationships, you will likely want to remove the current record from the set of results. + +This can be easily be done using the `ignoreRecord` argument. + +```php +use Filament\Forms\Components\Select; + +Select::make('parent_id') + ->relationship('parent', 'name', ignoreRecord: true) +``` + ### Customizing the relationship query You may customize the database query that retrieves options using the third parameter of the `relationship()` method: