Skip to content

Commit 28f847f

Browse files
authored
Make HasTimestamps::updateTimestamps public (#33953)
I've a use-case where I construct models but can't save them yet but they should reflect the state of new models as good as it gets, including the timestamps for created/updated, which I want to do from outside the model Similar to the `touch()` method: ```php public function touch() { if (! $this->usesTimestamps()) { return false; } $this->updateTimestamps(); return $this->save(); } ``` But I don't want to save the model _yet_. I can call `usesTimestamps()` from outside the model as its already public but not yet `updateTimestamps`, thus the PR.
1 parent 0d1ac32 commit 28f847f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function touch()
3434
*
3535
* @return void
3636
*/
37-
protected function updateTimestamps()
37+
public function updateTimestamps()
3838
{
3939
$time = $this->freshTimestamp();
4040

0 commit comments

Comments
 (0)