Skip to content

Commit dfec677

Browse files
added status accessor
1 parent b8199b0 commit dfec677

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/Models/Price.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,18 @@ public function toObject(): PriceObject
7979
{
8080
return PriceObject::ofMinor($this->amount, $this->currency);
8181
}
82+
83+
public function getStatusAttribute()
84+
{
85+
if($this->activated_at > now()) {
86+
return 'programmed';
87+
}
88+
89+
$current = $this->priceable->price()->first();
90+
if($current->id == $this->id) {
91+
return 'current';
92+
}
93+
94+
return 'passed';
95+
}
8296
}

0 commit comments

Comments
 (0)