88use Closure ;
99use Illuminate \Contracts \Validation \Rule ;
1010use Illuminate \Support \Str ;
11+ use Illuminate \Validation \Rules \Unique ;
1112use JsonSerializable ;
1213
13- /**
14- * @author Eduard Lupacescu <[email protected] > 15- */
1614class Field extends OrganicField implements JsonSerializable
1715{
1816 use Make;
@@ -312,21 +310,21 @@ public function getAttribute()
312310 */
313311 public function storingRules ($ rules )
314312 {
315- $ this ->storingRules = ($ rules instanceof Rule || is_string ($ rules )) ? func_get_args () : $ rules ;
313+ $ this ->storingRules = ($ rules instanceof Rule || is_string ($ rules ) || $ rules instanceof Unique ) ? func_get_args () : $ rules ;
316314
317315 return $ this ;
318316 }
319317
320318 public function storeBulkRules ($ rules )
321319 {
322- $ this ->storingBulkRules = ($ rules instanceof Rule || is_string ($ rules )) ? func_get_args () : $ rules ;
320+ $ this ->storingBulkRules = ($ rules instanceof Rule || is_string ($ rules ) || $ rules instanceof Unique ) ? func_get_args () : $ rules ;
323321
324322 return $ this ;
325323 }
326324
327325 public function updateBulkRules ($ rules )
328326 {
329- $ this ->updateBulkRules = ($ rules instanceof Rule || is_string ($ rules )) ? func_get_args () : $ rules ;
327+ $ this ->updateBulkRules = ($ rules instanceof Rule || is_string ($ rules ) || $ rules instanceof Unique ) ? func_get_args () : $ rules ;
330328
331329 return $ this ;
332330 }
@@ -350,7 +348,7 @@ public function storeRules($rules)
350348 */
351349 public function updatingRules ($ rules )
352350 {
353- $ this ->updatingRules = ($ rules instanceof Rule || is_string ($ rules )) ? func_get_args () : $ rules ;
351+ $ this ->updatingRules = ($ rules instanceof Rule || is_string ($ rules ) || $ rules instanceof Unique ) ? func_get_args () : $ rules ;
354352
355353 return $ this ;
356354 }
@@ -362,7 +360,7 @@ public function updatingRules($rules)
362360 */
363361 public function rules ($ rules )
364362 {
365- $ this ->rules = ($ rules instanceof Rule || is_string ($ rules )) ? func_get_args () : $ rules ;
363+ $ this ->rules = ($ rules instanceof Rule || is_string ($ rules ) || $ rules instanceof Unique ) ? func_get_args () : $ rules ;
366364
367365 return $ this ;
368366 }
0 commit comments