where('product_id', $productId) ->where('sku_id', $skuId) ->where('status', 'AVAILABLE') ->orderBy('id', 'asc') ->lockForUpdate() ->limit($qty) ->get(); return array_map(fn ($r) => (array)$r, $rows->all()); } public function updateStatusByIds(array $ids, string $status, array $extra = []): void { if (empty($ids)) return; $payload = array_merge([ 'status' => $status, 'updated_at' => now(), ], $extra); DB::table('gc_pins') ->whereIn('id', $ids) ->update($payload); } }