Skip to content

Commit 2ecf1a3

Browse files
authored
Update README.md
1 parent 6416958 commit 2ecf1a3

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,17 @@ To customize the prefix icon for each record in a tree page, you can use the `ge
343343
```php
344344
public function getTreeRecordIcon(?\Illuminate\Database\Eloquent\Model $record = null): ?string
345345
{
346-
// default null
347-
return 'heroicon-o-cake';
346+
if ($record->parent_id != -1) {
347+
return null; // no icon for child records
348+
}
349+
350+
return match ($record->title) {
351+
'Top' => 'heroicon-o-arrow-up',
352+
'Bottom' => 'heroicon-o-arrow-down',
353+
'Shoes' => 'heroicon-o-shopping-bag',
354+
'Accessories' => 'heroicon-o-briefcase',
355+
default => null, // no icon for other records
356+
};
348357
}
349358
```
350359

0 commit comments

Comments
 (0)