Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
hamidgh83 committed Oct 26, 2024
1 parent 9d15ac4 commit 9528754
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,23 @@ class YourModel extends Model

protected function getSlugConfig(): SlugOptions
{
return SlugOptions::create();
return SlugOptions::create()
->slugColumn('slugs') // Define the column name where the slugs will be stored
;
}
}
```

## Available Configuration Options

- **generateSlugsOnCreate(bool)**: Set to true if you want to generate slugs on model creation.
- **generateSlugsOnUpdate(bool)**: Set to true if you want to regenerate slugs when the model is updated.
- **doNotGenerateSlugsOnCreate()**: Call this method if you want to avoid generating slugs on model creation.
- **doNotGenerateSlugsOnUpdate()**: Call this method if you want to avoid generating slugs when the model is updated.
- **slugColumn(string)**: Define the column name where the slugs will be stored. The defined column type should be `json`.
- **slugSeparator(string)**: Character separator between words in the slug. (Default value is '-')
- **maximumLength(int)**: Maximum character length of the slug.

**Note**: Calling slugColumn() is required while defining the slug options.

## **Example**: Creating and Updating a Model with Slug Generation

When you create or update a model with HasSlug configured, the slug is automatically generated and saved according to the options you've specified.
Expand Down

0 comments on commit 9528754

Please sign in to comment.