Answers for "update multiple laravel"

PHP
0

laravel updateorcreate multiple records

// If there's a flight from Oakland to San Diego, set the price to $99.
// If no matching model exists, create one.
$flight = AppFlight::updateOrCreate(
    ['departure' => 'Oakland', 'destination' => 'San Diego'],
    ['price' => 99]
);
Posted by: Guest on April-03-2020
-1

laravel eloquent update multiple records

// in a single line here
$values = Cart::where('session_id', $id)->update(['data'=>$data]);
Posted by: Guest on August-27-2021
1

update many laravel

$post->comments()->updateMany([
    [
        'message' => 'A new comment.',
    ],
    [
        'message' => 'Another new comment.',
    ],
]);
Posted by: Guest on December-18-2020

Browse Popular Code Answers by Language