I have created a function for validation rule in add/edit "localities"
I have checked the name field as unique in "localities" table.
I have one more field "is_deleted" in localities table. If the "is_deleted" field value is 1, then it didn't ask the validation (i.e) No need to ask "Name is already in use".
public function rules()
{
return [
'name' => ['required', 'unique:localities'],
'city_id' => ['required']
];
}
How to create a custom rule for this condition