Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Unique validation rule ignored #2142

Unanswered
paoloveggi asked this question in Q&A
Discussion options

Hello guys,

I have the following validation rules on a store context:

'code' => [ 'required', 'max:30', Rule::unique('mongodb.plico_user_groups', 'code')->where('company_id', 1) ]

but the check for the unique key is ignored. I want to have a unique index based on the fields "code" and "company_id". If I try to insert twice the same "code" for the same "comapny_id" the rule doesn't fire as expected. In MongoDB fields are of type string for "code" and of type Int32 for "company_id". In above Rule::unique('mongodb.plico_user_groups', 'code') the "mongodb" part is the name of my connection and "plico_user_groups" is the name of the collection.

Please, someone can help?

Many thanks,
bye.

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant
Converted from issue

This discussion was converted from issue #2142 on December 02, 2020 04:00.

AltStyle によって変換されたページ (->オリジナル) /