Skip to content

Commit b83d157

Browse files
authored
consistently use Rule static methods (#9115)
while the previous code is correct, and the new code is simply a wrapper for the old code, every other example on this page uses the static method call to `Illuminate\Validation\Rule`, so we'll do this for consistency.
1 parent ed425de commit b83d157

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

validation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,10 +1234,10 @@ The field under validation must end with one of the given values.
12341234
The `Enum` rule is a class based rule that validates whether the field under validation contains a valid enum value. The `Enum` rule accepts the name of the enum as its only constructor argument:
12351235

12361236
use App\Enums\ServerStatus;
1237-
use Illuminate\Validation\Rules\Enum;
1237+
use Illuminate\Validation\Rule;
12381238

12391239
$request->validate([
1240-
'status' => [new Enum(ServerStatus::class)],
1240+
'status' => [Rule::enum(ServerStatus::class)],
12411241
]);
12421242

12431243
<a name="rule-exclude"></a>

0 commit comments

Comments
 (0)