Skip to content

Commit

Permalink
[9.x] Add createQuietly to HasOneOrMany (#45783)
Browse files Browse the repository at this point in the history
Co-authored-by: Valodia <v.khurshudyan@digitalpome.com>
  • Loading branch information
xurshudyan and Valodia authored Jan 24, 2023
1 parent 247735e commit 7f60262
Showing 1 changed file with 11 additions and 0 deletions.
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 @@ -323,6 +323,17 @@ public function create(array $attributes = [])
});
}

/**
* Create a new instance of the related model without raising any events to the parent model.
*
* @param array $attributes
* @return \Illuminate\Database\Eloquent\Model
*/
public function createQuietly(array $attributes = [])
{
return Model::withoutEvents(fn () => $this->create($attributes));
}

/**
* Create a new instance of the related model. Allow mass-assignment.
*
Expand Down

0 comments on commit 7f60262

Please sign in to comment.