1

I have an input with an array of entities with an ID which must be unique I've tried this:

'authors.*.id' => 'different:authors.*.id'

But it says 'The authors.0.id and authors.0.id must be different' So what is a right way to validate this?

1 Answer 1

8

You want to use distinct rule.

When working with arrays, the field under validation must not have any duplicate values.

'foo.*.id' => 'distinct'

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.