From 1c7fc17531c8af36e9b6a91793401e19bc590ced Mon Sep 17 00:00:00 2001 From: Yoga Pangestu Date: Tue, 7 Jul 2026 10:48:01 +0700 Subject: [PATCH] feat: enhance search functionality in RawMaterialService for improved filtering of raw materials --- app/Services/Master/RawMaterialService.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Services/Master/RawMaterialService.php b/app/Services/Master/RawMaterialService.php index 77f4773..1e29f90 100644 --- a/app/Services/Master/RawMaterialService.php +++ b/app/Services/Master/RawMaterialService.php @@ -37,7 +37,10 @@ public function paginateForIndex(array $tableQuery, string $isActive, string $st 'pendingOwnerVerificationRequest.submittedBy.profile', 'prices' => fn ($query) => $query ->orderBy('created_at') - ->with('media'), + ->with('media') + ->when($tableQuery['search'] !== '', function ($query) use ($tableQuery): void { + $query->where('variant', 'like', "%{$tableQuery['search']}%"); + }), ]) ->when($tableQuery['search'] !== '', function (Builder $query) use ($tableQuery): void { $search = $tableQuery['search'];