Laravel update multiple rows with different values

Today, We want to share with you Laravel update multiple rows with different values.In this post we will show you laravel eloquent update array, hear for How to update multiple row with different ID in Laravel 6, we will give you demo and example for implement.In this post, we will learn about laravel update multiple rows in one query with an example.

Laravel update multiple rows with different values

There are the Following The simple About laravel eloquent update multiple tables Full Information With Example and source code.

As I will cover this Post with live Working example to develop laravel update multiple rows with same values, so the Update multiple rows with different update values feature request is used for this example is following below.

How to update multiple row with different Collumns in Laravel 6,

DB::table('products')->where('product_id', $id)->where('ProductsName','ProductAdMaxImage')->update(['ProductDescValue' => $request->ProductAdMaxImage]);

DB::table('products')->where('product_id', $id)->where('ProductsName','ProductAdExpiredDay')->update(['ProductDescValue' => $request->ProductAdExpiredDay]);

Example 1: Update multiple rows of database in Laravel

$values = Cart::where('cart_id', $id)->update(['data'=>$data]);

Example 2 :Mass Updates records in Laravel Eloquent

App\CartTable::where('status', 2)
->where('destination', 'TamilRokers')
->update(['delayed' => 5]);

Example 3 :Update multiple records in Laravel Eloquent

$update_cart = Cart::where('cart_id', '=', $request->id)->update(['cart_id' => $request->cart_id]);
//$update_cart->save();

Example 4: Updating Multiple Records using Eloquent

Cart::whereIn('id', $ids)->update($request->all());

Web Programming Tutorials Example with Demo

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about laravel update multiple columns.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.


Related FAQ

Here are some more FAQ related to this Article:

  1.   ng-init Multiple Values using Angular Example
  2.   Laravel Update Multiple Records using Eloquent
  3.   How to Open URL in New Tab using Meteor.js
  4.   Curl GET And POST Method Calls – PHP Example
  5.   PHP Get Current URL Full Path HTTP-HTTPS Protocol
  6.   Update multiple records using Laravel
  7.   Send Forgot password by mail or message in PHP
  8.   Laravel Update Multiple Records using Laravel 5.8
  9.   Laravel 6.2 Create Custom Helper Tutorial with Example
  10.   PHP Sorting Multidimensional Array By Key