Greetings, i have this code that inserts an item on the table item_tbl and it should also get the added items primary key and insert it on table fields_tbl.
My question is how can i get the primary key of the item that i will add and insert it on the fields_tbl.
(item_tbl's primary key is a foreign key on fields_tbl)
DB::table('item_tbl')
->insert(array('item_name' => $data['itemTb']));
foreach($_POST["mytext"] as $labelField) {
DB::table('fields_tbl')
->insert(array('label' => $labelField));
}
return Redirect::back();