Skip to content

Commit 9a1ac30

Browse files
authored
Add touchQuietly convenience method (#44722)
1 parent 5459402 commit 9a1ac30

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/Illuminate/Database/Eloquent/Concerns/HasTimestamps.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,17 @@ public function touch($attribute = null)
4343
return $this->save();
4444
}
4545

46+
/**
47+
* Update the model's update timestamp without raising any events.
48+
*
49+
* @param string|null $attribute
50+
* @return bool
51+
*/
52+
public function touchQuietly($attribute = null)
53+
{
54+
return static::withoutEvents(fn () => $this->touch($attribute));
55+
}
56+
4657
/**
4758
* Update the creation and update timestamps.
4859
*

0 commit comments

Comments
 (0)