Skip to content

Commit 7a52972

Browse files
committed
Datastore TTL fix
Constant expression contains invalid operations
1 parent 175e998 commit 7a52972

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/Eloquent/Model.php

+14-9
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,6 @@ abstract class Model extends BaseModel
6868
*/
6969
protected $excludeFromIndexes = [];
7070

71-
/**
72-
* A list of attributes to exclude from the default indexing strategy.
73-
*
74-
* @var null|CarbonInterval
75-
*/
76-
protected $expireAfter;
77-
7871
/**
7972
* The primary key for the datastore should be "id".
8073
*
@@ -491,8 +484,10 @@ public function refresh()
491484
*/
492485
public function updateTimestamps()
493486
{
494-
if (null !== $this->expireAfter && $this->expireAfter instanceof CarbonInterval) {
495-
$time = $this->freshTimestamp()->add($this->expireAfter);
487+
$expireAfter = $this->getExpireAfterInterval();
488+
489+
if (null !== $expireAfter && $expireAfter instanceof CarbonInterval) {
490+
$time = $this->freshTimestamp()->add($expireAfter);
496491

497492
$expireAtColumn = $this->getExpireAtColumn();
498493

@@ -518,6 +513,16 @@ public function setExpireAt($value)
518513
return $this;
519514
}
520515

516+
/**
517+
* Get the expiry interval for the record.
518+
*
519+
* @return null|CarbonInterval
520+
*/
521+
public function getExpireAfterInterval()
522+
{
523+
return null;
524+
}
525+
521526
/**
522527
* Get the name of the "expire at" column.
523528
*

0 commit comments

Comments
 (0)