Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $data = DB::table('user.user_details')->where('vendor_id',$request->id)->orderBy('created_at','asc')->orderBy('client_id','asc')->get();
- // first i try get data before changing
- $vendor_array=[];
- foreach ($data as $key => $value){
- array_push($vendor_array,$value->vendor_profile_value);
- }
- // dd($vendor_array);
- <!-- then I try to enter the data that I send into the array -->
- $masuk=[];
- foreach($request->name as $item=>$value){
- $vendor_detail=array(
- 'name' =>$request->name[$item],
- 'categori'=>$request->category[$item],
- 'duration'=>$request->duration[$item],
- 'discount_status'=>$request->discount_status[$item],
- 'percentage' => $request->percentage[$item]
- );
- array_push($masuk,$vendor_detail);
- }
- $masuk=[];
- foreach($arrays as $key => $value){
- foreach($value as $key2 => $value2){
- array_push($masuk,$value2);
- }
- }
- <!-- then I tried updating it with the query builder by getting the previous data, but it didn't work -->
- // dd($masuk);
- foreach($vendor_array as $key => $value){
- foreach($masuk as $masuk_key => $masuk_value){
- $x = DB::table('koinpintar.vendor_details')->where([['vendor_id',$request->vendor_id],['vendor_profile_value',$value]])->update([
- 'vendor_profile_value' => $masuk_value
- ]);
- dd($x);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement