I have two Tables Brands and BrandTimings, I want to save brand with pickup and delivery time, and I have a form which I m submitting with all data I m getting an error, I understand error but i don't know how to assign pickup and delivery time to a variable and remove them and then using afterSave(), save them in BrandTimings with the newly created brand's id, I have tried beforeSave() and I couldn't understand how to do as October cms documentation has no example,
Column not found: 1054 Unknown column 'pickup_time' in 'field list' (SQL: insert into
offline_mall_brands(name,id,pickup_time,delivery_time,slug,website,description,updated_at,created_at) values (ASDE, 1, ["0","1"], ["2","3"], zip-jet, , , 2020-06-04 10:19:17, 2020-06-04 10:19:17))" on line 664 of /home/vagrant/code/cml/vendor/laravel/framework/src/Illuminate/Database/Connection.php
Brands
id name location
1 Inspire Lacer
BrandTimings
id brand_id pickup_time delivery_time
1 1 08:00 15:00
1 1 09:00 16:00
1 1 10:00 17:00
1 1 11:00 18:00
Oh I see what is happening.
Brandsdoesn't have the delivery_time butBrandTimingsdoes. One way that this would work is in your php. Now you don't mention if these models are related to each other so I won't write that way. And you don't show how you are attempting to save it now so I am going to make it up. Here is an example: