Skip to content

Commit 4f0bf6b

Browse files
Yury Wecernytaylorotwell
authored andcommitted
Use timestamps property getter in Eloquent Model (#17612)
1 parent fcbb90a commit 4f0bf6b

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ public function getDates()
744744
{
745745
$defaults = [static::CREATED_AT, static::UPDATED_AT];
746746

747-
return $this->timestamps ? array_merge($this->dates, $defaults) : $this->dates;
747+
return $this->usesTimestamps() ? array_merge($this->dates, $defaults) : $this->dates;
748748
}
749749

750750
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ trait HasTimestamps
2020
*/
2121
public function touch()
2222
{
23-
if (! $this->timestamps) {
23+
if (! $this->usesTimestamps()) {
2424
return false;
2525
}
2626

src/Illuminate/Database/Eloquent/Model.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ protected function performUpdate(Builder $query)
568568
// First we need to create a fresh query instance and touch the creation and
569569
// update timestamp on the model which are maintained by us for developer
570570
// convenience. Then we will just continue saving the model instances.
571-
if ($this->timestamps) {
571+
if ($this->usesTimestamps()) {
572572
$this->updateTimestamps();
573573
}
574574

@@ -626,7 +626,7 @@ protected function performInsert(Builder $query)
626626
// First we'll need to create a fresh query instance and touch the creation and
627627
// update timestamps on this model, which are maintained by us for developer
628628
// convenience. After, we will just continue saving these model instances.
629-
if ($this->timestamps) {
629+
if ($this->usesTimestamps()) {
630630
$this->updateTimestamps();
631631
}
632632

0 commit comments

Comments
 (0)