File tree Expand file tree Collapse file tree 1 file changed +26
-9
lines changed Expand file tree Collapse file tree 1 file changed +26
-9
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace Rakutentech \LaravelRequestDocs \Tests \Stubs \TestRules ;
4
4
5
- use Illuminate \Contracts \Validation \InvokableRule ;
5
+ use Illuminate \Contracts \Validation \Rule ;
6
6
7
- class Uppercase implements InvokableRule
7
+ class Uppercase implements Rule
8
8
{
9
9
/**
10
- * Run the validation rule.
10
+ * Create a new rule instance.
11
+ *
12
+ * @return void
13
+ */
14
+ public function __construct ()
15
+ {
16
+ //
17
+ }
18
+
19
+ /**
20
+ * Determine if the validation rule passes.
11
21
*
12
22
* @param string $attribute
13
23
* @param mixed $value
14
- * @param \Closure $fail
15
- * @return void
24
+ * @return bool
25
+ */
26
+ public function passes ($ attribute , $ value )
27
+ {
28
+ return strtoupper ($ value ) === $ value ;
29
+ }
30
+
31
+ /**
32
+ * Get the validation error message.
33
+ *
34
+ * @return string
16
35
*/
17
- public function __invoke ( $ attribute , $ value , $ fail )
36
+ public function message ( )
18
37
{
19
- if (strtoupper ($ value ) !== $ value ) {
20
- $ fail ('The :attribute must be uppercase. ' );
21
- }
38
+ return 'The :attribute must be uppercase. ' ;
22
39
}
23
40
}
You can’t perform that action at this time.
0 commit comments