From 3078923ea6dcd973fb9d2a19303d477d26542300 Mon Sep 17 00:00:00 2001 From: Dennis Elsinga Date: Sat, 23 Sep 2023 15:20:27 +0200 Subject: [PATCH] Fixed a bug where `defaultOpenLevel` had to be set --- README.md | 2 ++ src/SelectTree.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index da263c6..d3b52f7 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,8 @@ php artisan filament:assets ## Usage ```PHP +use CodeWithDennis\FilamentSelectTree\SelectTree; + // Create a tree based on a 'BelongsToMany' relationship SelectTree::make('categories') ->relationship('categories', 'name', 'parent_id', function ($query) { diff --git a/src/SelectTree.php b/src/SelectTree.php index bf1623e..31907b3 100644 --- a/src/SelectTree.php +++ b/src/SelectTree.php @@ -45,7 +45,7 @@ class SelectTree extends Field protected ?Closure $modifyQueryUsing; - protected Closure|int $defaultOpenLevel; + protected Closure|int $defaultOpenLevel = 0; protected string $direction = 'auto';