laravel validation numeric code example

Example 1: laravel validation integer

'count' => 'integer'

Example 2: numbric validate laravel

$rules = ['Fno' => 'numeric|min:2|max:5', 'Lno' => 'numeric|min:2'];

Example 3: laravel validate integer between

'item' => 'required|integer|between:1,10',

Example 4: laravel validator make custom message

$rules = [
        'name' => 'required',
        'email' => 'required|email',
        'message' => 'required|max:250',
    ];

    $customMessages = [
        'required' => 'The :attribute field is required.'
    ];

    $this->validate($request, $rules, $customMessages);

Example 5: laravel validation numeric vs integer

Integer is like a whole number without fraction: 2, 256, 2048
  
Numeric is any number including floating point numbers: 2.478, +0123.45e6

Example 6: laravel unique validation

unique:table,column,except,idColumn

############## Example : ################

############### For Updating  
//rules
'email' => 'unique:users,email_address,' . $userId,

############### For Creating 
//rules
'email' => 'unique:users,email_address',

Tags:

Php Example