@@ -38,6 +38,7 @@ public function addCriteria(): void
3838 'displayValue ' => $ condition ->displayValue (),
3939 'inputType ' => $ condition ->inputType ,
4040 'factor ' => $ condition ->factor ,
41+ 'options ' => $ condition ->options ?? [],
4142 ];
4243 }
4344
@@ -65,6 +66,7 @@ public function updatedCriteria($value, $indexOrKeyName): void
6566 'displayValue ' => $ this ->displayValueForOperation ($ firstOperationKey ),
6667 'inputType ' => $ this ->inputTypeForCondition ($ value ),
6768 'factor ' => $ this ->factorForCondition ($ value ),
69+ 'options ' => $ this ->optionsForCondition ($ value ),
6870 ];
6971 }
7072
@@ -103,12 +105,20 @@ public function inputTypeForCondition($key): string
103105 return $ condition ->inputType ;
104106 }
105107
106- public function factorForCondition ($ key ): string
108+ public function factorForCondition ($ key ): int
107109 {
108110 $ conditions = $ this ->resolveConditions ();
109111 $ condition = $ conditions ->firstWhere ('key ' , $ key );
110112
111- return $ condition ->factor ;
113+ return $ condition ->factor ?? 1 ;
114+ }
115+
116+ public function optionsForCondition ($ key ): array
117+ {
118+ $ conditions = $ this ->resolveConditions ();
119+ $ condition = $ conditions ->firstWhere ('key ' , $ key );
120+
121+ return $ condition ->options ?? [];
112122 }
113123
114124 public function displayExtraValueForOperation ($ value ): bool
@@ -177,7 +187,7 @@ private function getCriteriaClass($criteria
177187 return null ;
178188 }
179189
180- if ($ factor ) {
190+ if ($ factor && is_numeric ( $ value ) && $ factor !== 1 ) {
181191 $ value = $ value * $ factor ;
182192 }
183193
0 commit comments