Skip to content

Commit

Permalink
filter by order date
Browse files Browse the repository at this point in the history
  • Loading branch information
OniiCoder committed Feb 9, 2024
1 parent 4a7bd52 commit dd336b6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Traits/DateFilterExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ public function applyFilterExtension()
*/
$this->orders = Order::where('organization_id', $organization->id)
->where('status', '<>', 'CANCELED')
->whereBetween('created_at', [$this->startDate, $this->endDate])
->whereBetween('order_date', [$this->startDate, $this->endDate])
->get();

$this->ordersAmountTotal = Order::where('organization_id', $organization->id)
->where('status', '<>', 'CANCELED')
->whereBetween('created_at', [$this->startDate, $this->endDate])
->whereBetween('order_date', [$this->startDate, $this->endDate])
->select(DB::raw('SUM(volume * unit_price) AS total'))
->first();

$this->ordersVolumeTotal = Order::where('organization_id', $organization->id)
->where('status', '<>', 'CANCELED')
->whereBetween('created_at', [$this->startDate, $this->endDate])
->whereBetween('order_date', [$this->startDate, $this->endDate])
->sum('volume');

// -----------------
Expand Down

0 comments on commit dd336b6

Please sign in to comment.