daily pastebin goal
45%
SHARE
TWEET

Untitled

a guest May 27th, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $rules = [];
  2.  
  3. if ($request->primary_system == "1") {
  4.     $rules[] = ['custom_system', 'required'];            
  5. }
  6.  
  7. $validator = Validator::make($request->all(), $rules);
  8.  
  9. // Rules
  10. 5 => array:2 [
  11.     0 => "custom_system"
  12.     1 => "required"
  13. ]
  14.  
  15. // Outcome
  16. error: {5: ["The 5 field is required."]}
  17. 5: ["The 5 field is required."]
  18. 0: "The 5 field is required."
  19.  
  20. // Http post
  21. { custom_system: "foobaz" }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top