Skip to content

Commit 62fdecc

Browse files
committed
updated README.
1 parent b0db100 commit 62fdecc

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ This package hosts a robust and flexible trait designed for effortless slug gene
1515

1616
- **Unique Slug Enforcement**: Ensures that generated slugs are unique within the database table, preventing conflicts and maintaining data integrity.
1717

18+
- **SEO-Friendly URLs**: Facilitates the creation of SEO-friendly URLs by generating slugs based on user-friendly field values.
19+
20+
- **Groupable Slugs**: Supports the generation of unique slugs within a specific group, allowing for distinct slugs across different categories or sections. This practically means that you can have the same slug in different categories/tasks/projects/posts/etc.
21+
1822
- **Customizable Configuration**: Easily configure the field used for slug generation via Laravel's flexible configuration system, adapting to diverse project requirements effortlessly.
1923

2024

@@ -36,6 +40,7 @@ This is the contents of the published config file:
3640
// replace it with your model column
3741
return [
3842
'sluggable_field' => 'name',
43+
'groupable_field' => null, // 'category_id',
3944
];
4045

4146
```
@@ -67,6 +72,11 @@ class YourModel extends Model
6772
{
6873
return 'title'; // your own field on Model
6974
}
75+
// if you want to have unique slugs in different categories (groupable, such as project_id, team_id, category_id, etc.)
76+
public static function getGroupableField(): ?string
77+
{
78+
return 'category_id'; // your own field on Model
79+
}
7080
}
7181
```
7282
## Testing

0 commit comments

Comments
 (0)