Skip to content

Commit

Permalink
Make HasTimestamps::updateTimestamps public (#33953)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mfn committed Aug 20, 2020
1 parent 0d1ac32 commit 28f847f
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -34,7 +34,7 @@ public function touch()
*
* @return void
*/
protected function updateTimestamps()
public function updateTimestamps()
{
$time = $this->freshTimestamp();

Expand Down

0 comments on commit 28f847f

Please sign in to comment.