Open daily from 9:00 to 20:00Get in touch
NewWe collected answers to the questions people ask most oftenOpen the section →
🍪 Cookies and personal data

We use cookies to keep the site working and make it more convenient, and we process anonymised data about your visit. The details are in our privacy policy.

Model events: how saved differs from updated

31.08.2026 ~1 min read
Model events: how saved differs from updated

A model reports its own changes, and cache clearing rests on that. But two ways of changing a field raise DIFFERENT events, and the difference once cost us wrong stock figures on the site.

$product->save();              saving, updating, updated, saved
$product->decrement("stock");  updating, updated — and that is all

Counters do not raise the "saved" event at all. So subscribe to "created" and "updated": between them they cover both an ordinary save and writing stock off on a purchase.

More lessons in this course

Discussion

0

Only signed-in visitors can comment. Sign in to write.

Nobody has spoken up yet. Be the first.

Still have questions?We reply within one business day — write to us whichever way suits you.
Contact us