Skip to content

Commit cac6368

Browse files
Update README.md
1 parent 7b4f051 commit cac6368

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

README.md

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,39 +25,31 @@ php artisan filament:assets
2525
Use the tree for a `BelongsToMany` relationship
2626

2727
```PHP
28-
use CodeWithDennis\FilamentSelectTree\SelectTree;
29-
3028
SelectTree::make('categories')
3129
->relationship('categories', 'name', 'parent_id')
3230
```
3331

3432
Use the tree for a `BelongsTo` relationship
3533

3634
```PHP
37-
use CodeWithDennis\FilamentSelectTree\SelectTree;
38-
3935
SelectTree::make('category_id')
4036
->relationship('category', 'name', 'parent_id')
4137
```
4238

43-
## Customize Query
39+
## Custom Query
4440

45-
Customize the parent query:
41+
Customize the parent query
4642

4743
```PHP
48-
use CodeWithDennis\FilamentSelectTree\SelectTree;
49-
5044
SelectTree::make('categories')
51-
->relationship('categories', 'name', 'parent_id', modifyQueryUsing: fn($query) => $query));
45+
->relationship(relationship: 'categories', titleAttribute: 'name', parentAttribute: 'parent_id', modifyQueryUsing: fn($query) => $query));
5246
```
5347

54-
Customize the child query:
48+
Customize the child query
5549

5650
```PHP
57-
use CodeWithDennis\FilamentSelectTree\SelectTree;
58-
5951
SelectTree::make('categories')
60-
->relationship('categories', 'name', 'parent_id', modifyChildQueryUsing: fn($query) => $query));
52+
->relationship(relationship: 'categories', titleAttribute: 'name', parentAttribute: 'parent_id', modifyChildQueryUsing: fn($query) => $query));
6153
```
6254

6355
## Methods
@@ -197,6 +189,7 @@ use CodeWithDennis\FilamentSelectTree\SelectTree;
197189
})
198190
])
199191
```
192+
200193
## Screenshots
201194
![download.png](./resources/images/example.png)
202195

0 commit comments

Comments
 (0)