update batch (bulk) laravel
Click to install the latest version.
composer require mavinoo/update-batch:1.0
file app.php in array providers :
Mavinoo\UpdateBatch\UpdateBatchServiceProvider::class,
file app.php in array aliases :
'UpdateBatch' => Mavinoo\UpdateBatch\UpdateBatchFacade::class,
$table = 'users'; $value = [ [ 'id' => 1, 'status' => 'active', 'nickname' => 'Mohammad' ] , [ 'id' => 5, 'status' => 'deactive', 'nickname' => 'Ghanbari' ] , ]; $index = 'id'; UpdateBatch::updateBatch($table, $value, $index); $table = 'users'; $value = [ [ 'id' => 1, 'status' => 'active' ], [ 'id' => 5, 'status' => 'deactive', 'nickname' => 'Ghanbari' ], [ 'id' => 10, 'status' => 'active', 'date' => Carbon::now() ], [ 'id' => 11, 'username' => 'mavinoo' ] ]; $index = 'id'; UpdateBatch::updateBatch($table, $value, $index);