integraçao site
This commit is contained in:
@@ -12,4 +12,18 @@ class Order extends Model
|
||||
$stmt->execute();
|
||||
return $stmt->fetchAll();
|
||||
}
|
||||
|
||||
public function countAll()
|
||||
{
|
||||
$stmt = $this->conn->query("SELECT COUNT(*) as total FROM orders");
|
||||
return $stmt->fetch()['total'];
|
||||
}
|
||||
|
||||
public function countRecent($days = 7)
|
||||
{
|
||||
$stmt = $this->conn->prepare("SELECT COUNT(*) as total FROM orders WHERE created_at >= DATE_SUB(NOW(), INTERVAL :days DAY)");
|
||||
$stmt->bindValue(':days', $days, \PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
return $stmt->fetch()['total'];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user