I've tried following this question, which seems like what I want, but have had no luck.
I have a Page
model which has an incrementing id, a title, a slug (unique), and an html column. I want to be able to change the title, slug, and html fields. I've tried adding the rule:
'slug' => 'required|unique:pages,slug,{$this->slug}',
for my PATCH
request, but when I submit my form (with the same slug), I get an error that it's already taken. If I change the slug, the title and html changes, but the slug does not.
Ideally I'd rather have the slug be generated automatically and update in the background, but I've not been able to get that to work out either.
How can I allow for a changing unique field when updating a model, or generate it automatically?