Answers for "laravel update has many"

PHP
1

laravel has many

public function comments()
 {
   return $this->hasMany(Comment::class);
 }
Posted by: Guest on June-03-2021
1

update many laravel

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

Code answers related to "laravel update has many"

Browse Popular Code Answers by Language