I have the following problem: I have a product table that has a cod column. This product table has a one to many relationship with variation, one product can have multiple variations. The variation table also has a cod column.
product variation2 here product has two variations
cod 12 cod 13
id 1 product_id 1
user_id 100
variation1
cod 14
product_id 1
The user cannot insert the product if he already inserted a product or variation with a specific code.
I need to validate this using laravel. I really don't want to use eloquent to to this. I with I could use Laravel validation.
The farthest I could get was:
"cod" => 'unique:product|unique:variation'
But how can I base the validation by user_id on the product table?