10 Replies
?
i am sorry the code i paste is a bit messy, i am creating application where multiple item could be selected using Builder component and i also want to use Wizard Step so that after selecting mutiple item, in the next step i want to select a Branch(which is store branches) so that all those item could be inserted with the Branch store selected.
After selecting items and going to the next step it try to insert only the Branch.
Ok.. what is the error in your case?
The items selected using Builder is not sent to the database
The logic is to create cart like system
Is there a better way to achieve this.
After clicking submit it cannot save directly to database, you need to define the function and save manually.. check below code which is working
Result using above code
Thank you i will try that
StockTransfer::create(
$this->form->all()
);
Is there another way to store the data
$this->form->getState()
Play along this to get data.. for storing you can do whatever you want, search laravel$formData = $this->form->getState();
foreach ($formData as $data) {
$item_id = $data['item_id'];
$quantity = $data['quantity'];
$transfer_date = $data['transfer_date'];
$notes = $data['notes'];
$branch_id = $data['branch_id'];
StockTransfer::create([
'item_id' => $item_id,
'quantity' => $quantity,
'transfer_date' => $transfer_date,
'notes' => $notes,
'branch_id' => $branch_id,
]);
}
I tried this but i am getting array key not found
Try this
$this->form->getState()['data']