mardi 12 novembre 2019

combine three fields from form and validate uniqueness in table with two coumns in laravel 5.5

I am having a products create form, in that form, i am having product name, product quantity and product weight three fields that has to be inserted in products table. In products table i kept two fields to save these threefields i.e product name and product quantity(in which i am saving product quantity and product weight). i have shown an example of my query

Suppose in form user enters Dove 250 gm(These are three fields that will be come from that form) in data base i am saving them as like dove(in one field) 250 gm(in another field i.e product quantity). now i want, when creating a form a product with same name Dove 250 gm should be inserted again, for this i want a validation with uniquness, can anyone help me regarding this

At present i kept the validation as shown below

'name' => 'required|max:240|unique:products,name,NULL,product_quantity',

how to do this



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire