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
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.