From 9dd661ddb3c2d6ca901c76e57d4d9838f444a6c0 Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Fri, 19 Jul 2024 11:08:26 +0800 Subject: [PATCH] Fix query for gldetail when querying by norujukan --- app/Http/Controllers/TransactionOnlineController.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/TransactionOnlineController.php b/app/Http/Controllers/TransactionOnlineController.php index 70ea0b9..cd710d1 100644 --- a/app/Http/Controllers/TransactionOnlineController.php +++ b/app/Http/Controllers/TransactionOnlineController.php @@ -691,7 +691,7 @@ class TransactionOnlineController extends Controller $transaction = Transaction::whereDate('created_at', $date) ->where('teller', 'Online') ->when($request->norujukan, function ($query) use($request) { - return $query->where('norujukan', 'like', '%' . $request->norujukan . '%'); + return $query->where('norujukan', $request->norujukan); }) ->orderBy('created_at', 'desc') ->get() @@ -721,7 +721,6 @@ class TransactionOnlineController extends Controller $connectionCawangan = Cawangan::on('mysql7')->whereIn('kodcaw', $cawanganTransactionOnline)->get()->pluck('mysql'); - $glDetail = $connectionCawangan->map(fn ($x) => GlDetail::on($x)->where('teller', 'ONLINE')->whereDate('tarikh', $date)->get()) ->flatten() ->when($isGroupByNorujukan, function ($glDetail) { @@ -732,7 +731,7 @@ class TransactionOnlineController extends Controller }); }) ->when($request->filled('norujukan'), function ($glDetail) use($request) { - return $glDetail->where('norujukan', $request->norujukan); + return $glDetail->filter(fn($x) => strpos($x->descpt, $request->norujukan) !== false); }) ->sortKeysDesc() ->toArray();