saveQuietly Laravel 8
<?php $article = Article::findOrFail(1); $article->title = 'Article Number 1'; $article->saveQuietly();
<?php /** * The event map for the model. * * @var array */ protected $dispatchesEvents = [ 'updated' => ArticleSaved::class, 'saved' => ArticleSaved::class, ];
withoutEvents Laravel 7/8
For older Laravel versions you can make use of the "withoutEvents" static method like below.
<?php $user = User::withoutEvents(function () use () { $user = User::find(1); $user->name = 'John'; $user->save(); return $user; });
Leave a reply