Posts Learn Components new Snippets new Categories Tags About
/

How to Save Model Quietly on Laravel

Learn how to save model quietly on Laravel

Created on Sep 24, 2021

44 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();
new

If you like our tutorial, do make sure to support us with some coffee. We need the juice to write the content during the night 🤙🏻