Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Laravel: validate an integer field that needs to be greater than another

gt - greater than
gte - greater than equal to
lt - less than
lte - less than equal to

//so using gt you can check that your end_page should be greater than your initial_page and your task becomes very easy now:

$rules = [
  'initial_page' => 'required_with:end_page|integer|min:1|digits_between: 1,5',
  'end_page' => 'required_with:initial_page|integer|gt:initial_page|digits_between:1,5'
]; 
 
PREVIOUS NEXT
Tagged: #validate #integer #field #greater
ADD COMMENT
Topic
Name
2+5 =