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.

Read Also:  Laravel Vue JS CRUD Example Tutorial From Scratch

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 :

Read Also:  Integration with Pagination Without WordPress Plugins

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.