Home / Snippets / How to Save Model Quietly on Laravel
How to Save Model Quietly on Laravel cover

How to Save Model Quietly on Laravel

8.5K

3 years ago

0 comments

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();
notion avatar

Alaz

Week-end developer currently experimenting with web, mobile, and all things programming.

Topics:

Frontend

Resource

Average

Average

Support Us

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

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this