Closed nekooee closed 2 years ago
Hi, I use the following code to set the slug: $slug = SlugService::createSlug(Article::class, 'slug', $request->input('slug));
but when updating the model, a number is added to the slug. how to ignore the current slug for unique?
Thank you
Hi, I'm going through the same situation recently, I found the solution. When you updating your model just pass model instance of current article like this.
$article = Article::find($id); $slug = SlugService::createSlug($article, 'slug', $request->input('slug));
Hi, I use the following code to set the slug: $slug = SlugService::createSlug(Article::class, 'slug', $request->input('slug'));
but when updating the model, a number is added to the slug. how to ignore the current slug for unique?
Thank you