Laravel: isDirty() & wasChanged():
Master Laravel's isDirty() and wasChanged() methods for tracking model changes. Learn the difference, use cases, and practical examples .
February 4, 2026•2 min read•ssbhattarai
What Are These Methods?
Laravel provides powerful methods to track attribute changes in Eloquent models:
isDirty()- Check if attributes changed BEFORE savingwasChanged()- Check if attributes changed AFTER savingisClean()- Opposite of isDirty()getOriginal()- Get original valuesgetChanges()- Get all changes after save
Eloquent includes the isDirty, isClean, and wasChanged methods to help you inspect a model’s state and see how its attributes differ from their original values when the model was first loaded. These methods make it easy to detect whether any fields have been modified, remain unchanged, or were updated during the last save operation.
The Difference
$user = User::find(1);
$user->name = 'John Doe';
// Before save
$user->isDirty(); // true
$user->isDirty('name'); // true
$user->wasChanged(); // false
$user->save();
// After save
$user->isDirty(); // false
$user->wasChanged(); // true
$user->wasChanged('name'); // true
Key Point: isDirty() = before save, wasChanged() = after save
All Available Methods
Check for Changes
// Check if ANY attribute changed
$model->isDirty(); // Before save
$model->isClean(); // Opposite of isDirty()
$model->wasChanged(); // After save
// Check SPECIFIC attribute
$model->isDirty('email');
$model->isClean('email');
$model->wasChanged('email');
// Check MULTIPLE attributes
$model->isDirty(['name', 'email']);
$model->wasChanged(['name', 'email']);
Get Values
// Get original value (before changes)
$model->getOriginal(); // All original values
$model->getOriginal('email'); // Specific field
// Get changes (after save)
$model->getChanges(); // All changed values
// Get previous values (before last save)
$model->getPrevious(); // All previous values
$model->getPrevious('email'); // Specific field
Want to dive deeper into tracking changes? Explore alternative approaches and advanced patterns in the full documentation.