Keep track of discontinued items. That means items that were tracked, but then they were never updated.Added is discontinued badge.
This commit is contained in:
@@ -7,6 +7,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
|
||||
use function Symfony\Component\Clock\now;
|
||||
|
||||
/**
|
||||
* @property integer $skuID
|
||||
* @property string $name
|
||||
@@ -66,9 +68,12 @@ class Product extends Model
|
||||
);
|
||||
}
|
||||
|
||||
public function isnew(): bool
|
||||
public function isDiscontinued(): bool
|
||||
{
|
||||
$newDate = (new \DateTime())->modify('-30 days')->format('Y-m-d');
|
||||
return $this->created_at->format('Y-m-d') > $newDate;
|
||||
return $this->updated_at->format('Y-m-d') < now()->format('Y-m-d');
|
||||
}
|
||||
public function isNew(): bool
|
||||
{
|
||||
return $this->created_at->format('Y-m-d') > now()->modify('-30 days')->format('Y-m-d');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user