Unique things #68
Replies: 1 comment
-
You'll either need to tell the unique rule to ignore the record and all its revisions/drafts or only consider the published revisions. Which option you go for will depend on your use-case. Things to considerIgnoring record's revisions/draftsAny stale revisions from other records will prevent you from using the same slug even though you might not care about that. 'slug' => [Rule::unique('pages')->ignore($page->uuid, 'uuid')], Only validate again published revisionsYou could end up with drafts that can't be published because another record has taken the slug it was drafted with. 'slug' => [Rule::unique('pages')->ignore($page->id)->where(fn (Builder $query) => $query->where('is_published', true)], |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have validation error when i used the unique for my tables
This my model
title
slug: unique
description
why i just get the error the data exists when i updating?
My Stack :
Beta Was this translation helpful? Give feedback.
All reactions