Me neither :)
Glad to hear that you got it now. Everyone of us knows the human brain freezing bug. Thats why such a great forum like Laracasts is so amazing and enthusiasts help each other :)
I will go home now but afterwards I will check your latest posts so that we can get it working!
Basically you see this:
'size' => string '6' (length=1)
'colour' => string 'Black' (length=5)
'stock' => string '2' (length=1)
'size_1' => string '10' (length=2)
'colour_1' => string 'Cream' (length=5)
'stock_1' => string '3' (length=1)
has two different set of values correct? I need to them add both values to the db with the same product_id but it inserting the first size, colour, stock values twice.
like so - http://cl.ly/image/1A3V3m0X3i2b When in actual fact it should do this - http://cl.ly/image/1w3O373F0z03
And i've been trying to do it like this:
if (Input::get('size') ?: null) {
$option = new Options;
$option->product_id = '1';
$option->size = Input::get('size');
$option->colour = Input::get('colour');
$option->stock = Input::get('stock');
$option->save();
}
if (Input::get('size_1') ?: null) {
$option = new Options;
$option->product_id = '1';
$option->size = Input::get('size');
$option->colour = Input::get('colour');
$option->stock = Input::get('stock');
$option->save();
}
has i though using new Options; twice would insert twice as two different values.
you're repeating the same values in both records you need to do this for the second record:
$option->size = Input::get('size_1');
$option->colour = Input::get('colour_1');
$option->stock = Input::get('stock_1');
So i am, doh! how stupid am i
@arabsight fixed i'm so dumb at times! lol
So based on @arabsight said, now how do I show the value within my edit form as the selected value then show the rest of the list from the relevant table, and the rest of the options from the colour's table like I did before like this
Colours::lists('name', 'name')
So everything works now? Do you use the normalized table structure?
ye like u said
Just need to get the edit form working now
so can you help?
@bart can you help me with edit form and showing the dropdown on the products page?
What exactly is the problem you have with the form?
I need it to populate what comes from the database then also show the reminder of the list from the colour, size tables.
Please or to participate in this conversation.