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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user