EMfinanga
1 month ago
180
5
Laravel

Update multiple data

Posted 1 month ago by EMfinanga

This code below is for create data into database

I want to create the code for update

 $data=$request->all();
    $lastid=Customer_cash::create($data)->id;
    if(count($request->item_id) > 0)
    {
        foreach($request->item_id as $key=>$v){
            $data2=([
                'Cash_no'=>$fk,
                'customer_cash_id'=>$lastid,
                'item_id'=>$request->item_id [$key],
                'store_id'=>$request->store_id [$key],
                'quantity'=>$request->qty [$key],
                'rate'=>$request->selling_price [$key],
                'amount'=>$request->amount [$key],
            ]);

            CashSales::create($data2);
             }
    return redirect()->back()->with('success', 'Successfully Stored');

    }

Please sign in or create an account to participate in this conversation.