fix: exclude cancelled orders from dashboard statistics

The ``scopeNotCancelled`` scope on ``Order`` filters out orders with
status 4 (Annulé). All ``OrderMetrics`` methods now chain
``notCancelled()`` so that dashboard counts and totals ignore cancelled
orders.
This commit is contained in:
Valentin Lab
2026-02-20 11:38:06 +01:00
parent 936c9473a7
commit e4540f9d88
2 changed files with 12 additions and 7 deletions

View File

@@ -92,6 +92,11 @@ class Order extends Model
return $query->byStatus(3);
}
public function scopeNotCancelled($query)
{
return $query->where('status', '!=', 4);
}
public function scopeByStatus($query, $status)
{
return $query->where('status', $status);