But I'm getting the following 'Integrity constraint violation' error because the product requires a one-to-many relation with the attribute_set table. How can solve this?
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`cms_v1.1`.`products`, CONSTRAINT `products_attribute_set_id_foreign` FOREIGN KEY (`attribute_set_id`) REFERENCES `attribute_sets` (`id`) ON DELETE CASCADE) (SQL: insert into `products` (`price`, `updated_at`, `created_at`) values (10.00, 2016-01-29 08:56:30, 2016-01-29 08:56:30))
Without the use of repositories I would simply do it like this:
I'm struggling with the following problem, I have a product model that looks like this:
Now I'm trying to save my model in my controller like this:
This is the die and dump from the input:
But I'm getting the following 'Integrity constraint violation' error because the product requires a one-to-many relation with the attribute_set table. How can solve this?
Without the use of repositories I would simply do it like this: