Posts Learn Components Snippets Categories Tags Tools About
/

How to Save Model Quietly on Laravel

Learn how to save model quietly on Laravel

Created on Sep 24, 2021

2748 views

To quietly save a model in Laravel you can make use of the "saveQuietly" method available to each model instance.
->saveQuietly();
The benefit of "saveQuietly" is that it won't fire off any of the model events. By doing so you will be able to prevent model event loops that can indefinitely fire the events.
<?php

$article = Article::findOrFail(1);

$article->title = 'Article Number 1';

$article->saveQuietly();

If you like our tutorial, do make sure to support us by being our Patreon or buy us some coffee ☕️

Load comments for How to Save Model Quietly on Laravel

)