1616
1717trait ReplacesAttributes
1818{
19+ /**
20+ * Replace all place-holders for the accepted_if rule.
21+ */
22+ protected function replaceAcceptedIf (string $ message , string $ attribute , string $ rule , array $ parameters ): string
23+ {
24+ $ parameters [1 ] = $ this ->getDisplayableValue ($ parameters [0 ], Arr::get ($ this ->data , $ parameters [0 ]));
25+
26+ $ parameters [0 ] = $ this ->getDisplayableAttribute ($ parameters [0 ]);
27+
28+ return str_replace ([':other ' , ':value ' ], $ parameters , $ message );
29+ }
30+
31+ /**
32+ * Replace all place-holders for the declined_if rule.
33+ */
34+ protected function replaceDeclinedIf (string $ message , string $ attribute , string $ rule , array $ parameters ): string
35+ {
36+ $ parameters [1 ] = $ this ->getDisplayableValue ($ parameters [0 ], Arr::get ($ this ->data , $ parameters [0 ]));
37+
38+ $ parameters [0 ] = $ this ->getDisplayableAttribute ($ parameters [0 ]);
39+
40+ return str_replace ([':other ' , ':value ' ], $ parameters , $ message );
41+ }
42+
1943 /**
2044 * Replace all place-holders for the between rule.
2145 */
@@ -78,6 +102,14 @@ protected function replaceMin(string $message, string $attribute, string $rule,
78102 return str_replace (':min ' , $ parameters [0 ], $ message );
79103 }
80104
105+ /**
106+ * Replace all place-holders for the min digits rule.
107+ */
108+ protected function replaceMinDigits (string $ message , string $ attribute , string $ rule , array $ parameters ): string
109+ {
110+ return str_replace (':min ' , $ parameters [0 ], $ message );
111+ }
112+
81113 /**
82114 * Replace all place-holders for the max rule.
83115 */
@@ -86,6 +118,61 @@ protected function replaceMax(string $message, string $attribute, string $rule,
86118 return str_replace (':max ' , $ parameters [0 ], $ message );
87119 }
88120
121+ /**
122+ * Replace all place-holders for the max digits rule.
123+ */
124+ protected function replaceMaxDigits (string $ message , string $ attribute , string $ rule , array $ parameters ): string
125+ {
126+ return str_replace (':max ' , $ parameters [0 ], $ message );
127+ }
128+
129+ /**
130+ * Replace all place-holders for the missing_if rule.
131+ */
132+ protected function replaceMissingIf (string $ message , string $ attribute , string $ rule , array $ parameters ): string
133+ {
134+ $ parameters [1 ] = $ this ->getDisplayableValue ($ parameters [0 ], Arr::get ($ this ->data , $ parameters [0 ]));
135+
136+ $ parameters [0 ] = $ this ->getDisplayableAttribute ($ parameters [0 ]);
137+
138+ return str_replace ([':other ' , ':value ' ], $ parameters , $ message );
139+ }
140+
141+ /**
142+ * Replace all place-holders for the missing_unless rule.
143+ */
144+ protected function replaceMissingUnless (string $ message , string $ attribute , string $ rule , array $ parameters ): string
145+ {
146+ return str_replace ([':other ' , ':value ' ], [
147+ $ this ->getDisplayableAttribute ($ parameters [0 ]),
148+ $ this ->getDisplayableValue ($ parameters [0 ], $ parameters [1 ]),
149+ ], $ message );
150+ }
151+
152+ /**
153+ * Replace all place-holders for the missing_with rule.
154+ */
155+ protected function replaceMissingWith (string $ message , string $ attribute , string $ rule , array $ parameters ): string
156+ {
157+ return str_replace (':values ' , implode (' / ' , $ this ->getAttributeList ($ parameters )), $ message );
158+ }
159+
160+ /**
161+ * Replace all place-holders for the missing_with_all rule.
162+ */
163+ protected function replaceMissingWithAll (string $ message , string $ attribute , string $ rule , array $ parameters ): string
164+ {
165+ return $ this ->replaceMissingWith ($ message , $ attribute , $ rule , $ parameters );
166+ }
167+
168+ /**
169+ * Replace all place-holders for the multiple_of rule.
170+ */
171+ protected function replaceMultipleOf (string $ message , string $ attribute , string $ rule , array $ parameters ): string
172+ {
173+ return str_replace (':value ' , $ parameters [0 ] ?? '' , $ message );
174+ }
175+
89176 /**
90177 * Replace all place-holders for the in rule.
91178 */
@@ -326,6 +413,18 @@ protected function replaceEndsWith(string $message, string $attribute, string $r
326413 return str_replace (':values ' , implode (', ' , $ parameters ), $ message );
327414 }
328415
416+ /**
417+ * Replace all place-holders for the doesnt_end_with rule.
418+ */
419+ protected function replaceDoesntEndWith (string $ message , string $ attribute , string $ rule , array $ parameters ): string
420+ {
421+ foreach ($ parameters as &$ parameter ) {
422+ $ parameter = $ this ->getDisplayableValue ($ attribute , $ parameter );
423+ }
424+
425+ return str_replace (':values ' , implode (', ' , $ parameters ), $ message );
426+ }
427+
329428 /**
330429 * Replace all place-holders for the starts_with rule.
331430 */
@@ -338,6 +437,18 @@ protected function replaceStartsWith(string $message, string $attribute, string
338437 return str_replace (':values ' , implode (', ' , $ parameters ), $ message );
339438 }
340439
440+ /**
441+ * Replace all place-holders for the doesnt_start_with rule.
442+ */
443+ protected function replaceDoesntStartWith (string $ message , string $ attribute , string $ rule , array $ parameters ): string
444+ {
445+ foreach ($ parameters as &$ parameter ) {
446+ $ parameter = $ this ->getDisplayableValue ($ attribute , $ parameter );
447+ }
448+
449+ return str_replace (':values ' , implode (', ' , $ parameters ), $ message );
450+ }
451+
341452 /**
342453 * Replace all place-holders for the prohibited_with rule.
343454 * @param array<int,string> $parameters
0 commit comments