5
5
use Illuminate \Contracts \Support \Arrayable ;
6
6
use Illuminate \Support \Traits \Macroable ;
7
7
use Illuminate \Validation \Rules \Dimensions ;
8
+ use Illuminate \Validation \Rules \Enum ;
8
9
use Illuminate \Validation \Rules \ExcludeIf ;
9
10
use Illuminate \Validation \Rules \Exists ;
11
+ use Illuminate \Validation \Rules \File ;
12
+ use Illuminate \Validation \Rules \ImageFile ;
10
13
use Illuminate \Validation \Rules \In ;
11
14
use Illuminate \Validation \Rules \NotIn ;
12
15
use Illuminate \Validation \Rules \ProhibitedIf ;
@@ -31,14 +34,26 @@ public static function when($condition, $rules, $defaultRules = [])
31
34
}
32
35
33
36
/**
34
- * Get a dimensions constraint builder instance .
37
+ * Create a new nested rule set .
35
38
*
36
- * @param array $constraints
37
- * @return \Illuminate\Validation\Rules\Dimensions
39
+ * @param callable $callback
40
+ * @return \Illuminate\Validation\NestedRules
38
41
*/
39
- public static function dimensions ( array $ constraints = [] )
42
+ public static function forEach ( $ callback )
40
43
{
41
- return new Dimensions ($ constraints );
44
+ return new NestedRules ($ callback );
45
+ }
46
+
47
+ /**
48
+ * Get a unique constraint builder instance.
49
+ *
50
+ * @param string $table
51
+ * @param string $column
52
+ * @return \Illuminate\Validation\Rules\Unique
53
+ */
54
+ public static function unique ($ table , $ column = 'NULL ' )
55
+ {
56
+ return new Unique ($ table , $ column );
42
57
}
43
58
44
59
/**
@@ -83,17 +98,6 @@ public static function notIn($values)
83
98
return new NotIn (is_array ($ values ) ? $ values : func_get_args ());
84
99
}
85
100
86
- /**
87
- * Create a new nested rule set.
88
- *
89
- * @param callable $callback
90
- * @return \Illuminate\Validation\NestedRules
91
- */
92
- public static function forEach ($ callback )
93
- {
94
- return new NestedRules ($ callback );
95
- }
96
-
97
101
/**
98
102
* Get a required_if constraint builder instance.
99
103
*
@@ -128,14 +132,44 @@ public static function prohibitedIf($callback)
128
132
}
129
133
130
134
/**
131
- * Get a unique constraint builder instance.
135
+ * Get an enum constraint builder instance.
132
136
*
133
- * @param string $table
134
- * @param string $column
135
- * @return \Illuminate\Validation\Rules\Unique
137
+ * @param string $type
138
+ * @return \Illuminate\Validation\Rules\Enum
136
139
*/
137
- public static function unique ( $ table , $ column = ' NULL ' )
140
+ public static function enum ( $ type )
138
141
{
139
- return new Unique ($ table , $ column );
142
+ return new Enum ($ type );
143
+ }
144
+
145
+ /**
146
+ * Get a file constraint builder instance.
147
+ *
148
+ * @return \Illuminate\Validation\Rules\File
149
+ */
150
+ public static function file ()
151
+ {
152
+ return new File ;
153
+ }
154
+
155
+ /**
156
+ * Get an image file constraint builder instance.
157
+ *
158
+ * @return \Illuminate\Validation\Rules\ImageFile
159
+ */
160
+ public static function imageFile ()
161
+ {
162
+ return new ImageFile ;
163
+ }
164
+
165
+ /**
166
+ * Get a dimensions constraint builder instance.
167
+ *
168
+ * @param array $constraints
169
+ * @return \Illuminate\Validation\Rules\Dimensions
170
+ */
171
+ public static function dimensions (array $ constraints = [])
172
+ {
173
+ return new Dimensions ($ constraints );
140
174
}
141
175
}
0 commit comments