nhayder
1 month ago

How to validate Slug on update

Posted 1 month ago by nhayder

i have article crud from with article slug text field, when the article is created i'm validating the article slug like this

'slug' => 'required|string|max:255|unique:categories',

The issue that i'm having is when i attempting to update the form without changing the slug, the code above is returning

The slug has already been taken

Tthat is totally expected because the unique:categories is supposed to do that?

My question is??? What is the laravel way to handle this type of validation.

thanx

Please sign in or create an account to participate in this conversation.