Fix BadMethodCallException and remaining PostgreSQL issues

This commit is contained in:
2026-05-14 12:24:33 +07:00
parent b76d34cc64
commit ce2b815b07
4 changed files with 18 additions and 6 deletions

View File

@@ -118,7 +118,7 @@ public function dashboard()
$sales_data = Sale::selectRaw("TO_CHAR(created_at, '$dateFormatSQL') as date, SUM(\"totalAmount\") as amount")
->where('business_id', $business_id)
->whereBetween('created_at', [$start, $end])
->groupBy('date')
->groupBy(DB::raw("TO_CHAR(created_at, '$dateFormatSQL')"))
->orderBy('date')
->get()
->map(function ($item) {
@@ -131,7 +131,7 @@ public function dashboard()
$purchase_data = Purchase::selectRaw("TO_CHAR(created_at, '$dateFormatSQL') as date, SUM(\"totalAmount\") as amount")
->where('business_id', $business_id)
->whereBetween('created_at', [$start, $end])
->groupBy('date')
->groupBy(DB::raw("TO_CHAR(created_at, '$dateFormatSQL')"))
->orderBy('date')
->get()
->map(function ($item) {