samedi 18 juillet 2020

How to update rows when there is multiple rows in Laravel

I have an attribute table and attribute values table like:

id | Attribute Name
 2    Color

Now i'm saving this attribute values in another table attribute_values

id | attribute_id | values

1       2           Green
2       2           Red

Now there is a issue when i want to update its values, suppose on the update screen user may select only one attribute so i want to know which is the best way to update its values so that if any value is not present it can be removed on update. Right now i'm deleting the old rows and inserting new one but this will consume time.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire