File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ public function __construct($key, $label)
2121 {
2222 $ this ->key = $ key ;
2323 $ this ->label = $ label ;
24- $ this ->code = $ label . ' : ' . $ this ->operator ;
24+ $ this ->code = $ this ->buildCode () ;
2525 }
2626
2727 public static function make ($ label , $ key = null ): static
@@ -61,11 +61,30 @@ public function component(): string
6161 public function useOperator (string $ operator ): static
6262 {
6363 $ this ->operator = $ operator ;
64- $ this ->code = $ this ->label . ' : ' . $ this -> operator ;
64+ $ this ->code = $ this ->buildCode () ;
6565
6666 return $ this ;
6767 }
6868
69+ /**
70+ * Build the filter code from the label and a Blade-safe operator alias.
71+ *
72+ * Operators like >= and <= are mapped to gte/lte so that Blade's {{ }}
73+ * HTML-encoding does not break wire:model bindings.
74+ */
75+ private function buildCode (): string
76+ {
77+ $ operator = match ($ this ->operator ) {
78+ '>= ' => 'gte ' ,
79+ '<= ' => 'lte ' ,
80+ '> ' => 'gt ' ,
81+ '< ' => 'lt ' ,
82+ default => $ this ->operator ,
83+ };
84+
85+ return $ this ->label .': ' .$ operator ;
86+ }
87+
6988 public function useComponent (string $ component ): static
7089 {
7190 $ this ->component = $ component ;
You can’t perform that action at this time.
0 commit comments