Saving Array ID to Database with value to each id

Good Evening.... Hope i can explain my problem correctly. I am getting data (ID) in array and value (numbers) in controller. Now i want to save the "numbers" in each "ID".

       array ID ["Buffalo-01", "Buffalo-02", "Buffalo-04"] 
       Numbers - 40.

Want to save 40 to each ID.

Controller

    public function addbuffalototalmilk(Request $req )
        {
            $buffalomilking         =   Buffalodata::where('avgmilk','<>','0')->Where('status','=','Available')->count(); // MIlking Animal Nos
            $getbuffalomilkingid    =   Buffalodata::where('avgmilk','<>','0')->Where('status','=','Available')->pluck('buffaloID'); // Get Buffalo Details of Milking

            $totalmorningmilk       =   $req->get('morningtotalmilk');
            $totaleveningmilk       =   $req->get('eveningtotalmilk');

            $eachmorningmilk        =   ($totalmorningmilk / $buffalomilking);
            $eacheveningmilk        =   ($totaleveningmilk / $buffalomilking);

        
            
            
            return response ();
        } 

Thanks in Advance



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation