laravel 'required|rule' code example
Example 1: laravel validate integer between
'item' => 'required|integer|between:1,10',
Example 2: php artisan make:request
php artisan make:request User\CreateUserRequest
Example 3: laravel validation custom message example
$rules = [
'name' => 'required',
'email' => 'required|email',
'message' => 'required|max:250',
];
$customMessages = [
'required' => 'The :attribute field is required.'
];
$this->validate($request, $rules, $customMessages);
Example 4: validate field for existing client laravel
unique:users,username,id,1