Fix on invoices, add delivery reference, wip on dashboard concurrency requests designed on template
This commit is contained in:
@@ -31,4 +31,14 @@ class Invoice extends Model
|
||||
{
|
||||
return $this->belongsToThrough(Customer::class, Order::class, null, '', [Customer::class => 'customer_id', Order::class => 'order_id']);
|
||||
}
|
||||
|
||||
public function scopeByUUID($query, $uuid)
|
||||
{
|
||||
return $query->where('uuid', $uuid);
|
||||
}
|
||||
|
||||
public function scopeByPeriod($query, $start, $end)
|
||||
{
|
||||
return $query->whereBetween('created_at', [$start, $end]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,11 @@ class Order extends Model
|
||||
return $this->belongsTo(SaleChannel::class);
|
||||
}
|
||||
|
||||
public function scopeByUUID($query, $uuid)
|
||||
{
|
||||
return $query->where('uuid', $uuid);
|
||||
}
|
||||
|
||||
public function scopeByCustomer($query, $customer_id)
|
||||
{
|
||||
return $query->where('customer_id', $customer_id);
|
||||
@@ -56,6 +61,21 @@ class Order extends Model
|
||||
return $query->where('delivery_id', $delivery_id);
|
||||
}
|
||||
|
||||
public function scopePreparation($query)
|
||||
{
|
||||
return $query->byStatus(1);
|
||||
}
|
||||
|
||||
public function scopeSended($query)
|
||||
{
|
||||
return $query->byStatus(2);
|
||||
}
|
||||
|
||||
public function scopeReceived($query)
|
||||
{
|
||||
return $query->byStatus(3);
|
||||
}
|
||||
|
||||
public function scopeByStatus($query, $status)
|
||||
{
|
||||
return $query->where('status', $status);
|
||||
@@ -65,4 +85,9 @@ class Order extends Model
|
||||
{
|
||||
return $query->where('payment_type', $payment_type);
|
||||
}
|
||||
|
||||
public function scopeByPeriod($query, $start, $end, $field = 'created_at')
|
||||
{
|
||||
return $query->whereBetween($field, [$start, $end]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user