Answers for "laravel update order field sample"

PHP
1

laravel update order field sample

$order = 1;

$records = Model::all();

foreach($records as $row) {
    $row->order = $order;
    $row->update();
    $order++;
}
Posted by: Guest on October-12-2021

Browse Popular Code Answers by Language