Issue #1259
This commit is contained in:
parent
8d578c3720
commit
f49e25ea1f
|
|
@ -79,6 +79,12 @@ class ProductForm extends FormRequest
|
|||
|
||||
$inputs = $this->all();
|
||||
|
||||
if (isset($inputs['variants'])) {
|
||||
foreach ($inputs['variants'] as $key => $variant) {
|
||||
$this->rules['variants'.'.'.$key.'.'.'sku'] = ['unique:products,sku,' . $key, new \Webkul\Core\Contracts\Validations\Slug];
|
||||
}
|
||||
}
|
||||
|
||||
$product = $this->product->find($this->id);
|
||||
|
||||
$attributes = $product->attribute_family->custom_attributes;
|
||||
|
|
@ -131,4 +137,16 @@ class ProductForm extends FormRequest
|
|||
|
||||
return $this->rules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom message for validation
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'variants.*.sku.unique' => 'The sku has already been taken.',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue