i'm working on a project for my homework which i'm trying to make it work as a spa, but I've got some problem in making slug for posts.

in the tutorial which i've followed, instructor used this to make a slug from title :

```
protected static function boot()
{
    parent::boot();

    static::creating(function ($course){
        $course->slug = str_slug($course->name);
    });
}

```

now, if i make this table unique, which this is what i wanna do. how should i prevent app from giving me duplicate entry? or how can i add something to slug, like a number, Every time i get duplicate entry?

if i make a post with `This Post` name twice, second time, i get duplicate Error.