Handle lastSeen column and all the discontinued items.
This commit was merged in pull request #35.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Krzysiej\RyobiCrawler\Models;
|
||||
|
||||
use Carbon\Traits\Date;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
@@ -24,6 +25,7 @@ use function Symfony\Component\Clock\now;
|
||||
* @property float $priceLowest
|
||||
* @property float $productStandardPrice
|
||||
* @property float $lowestProductPrice30Days
|
||||
* @property Date $lastSeen
|
||||
*/
|
||||
class Product extends Model
|
||||
{
|
||||
@@ -81,7 +83,7 @@ class Product extends Model
|
||||
|
||||
public function isDiscontinued(): bool
|
||||
{
|
||||
return $this->updated_at->format('Y-m-d') < now()->format('Y-m-d');
|
||||
return $this->lastSeen < now()->format('Y-m-d');
|
||||
}
|
||||
public function isNew(): bool
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user