Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Illuminate/Database/Eloquent/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,16 @@ public function push()
return true;
}

/**
* Save the model and all of its relationships without raising any events to the parent model.
*
* @return bool
*/
public function pushQuietly()
{
return static::withoutEvents(fn () => $this->push());
}

/**
* Save the model to the database without raising any events.
*
Expand Down
11 changes: 11 additions & 0 deletions src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,17 @@ public function createMany(iterable $records)
return $instances;
}

/**
* Create a Collection of new instances of the related model without raising any events to the parent model.
*
* @param iterable $records
* @return \Illuminate\Database\Eloquent\Collection
*/
public function createManyQuietly(iterable $records)
{
return Model::withoutEvents(fn () => $this->createMany($records));
}

/**
* Set the foreign ID for creating a related model.
*
Expand Down