1$rules = [
2 'name' => 'required',
3 'email' => 'required|email',
4 'message' => 'required|max:250',
5 ];
6
7 $customMessages = [
8 'required' => 'The :attribute field is required.'
9 ];
10
11 $this->validate($request, $rules, $customMessages);
1$this->validate([
2 'userid' =>'required|min:3|max:100',
3 'username' =>'required|min:3',
4 'password' =>'required|max:15|confirmed',
5], [], [
6 'userid' => 'User ID'
7]);
1$rules = [
2 'name' => 'required',
3 'email' => 'required|email',
4 'message' => 'required|max:250',
5 ];
6
7 $customMessages = [
8 'required' => 'The :attribute field is required.'
9 ];
10
11 $this->validate($request, $rules, $customMessages);
12//@sujay
1$messsages = [
2 'email.required'=>'You cant leave Email field empty',
3 'name.required'=>'You cant leave name field empty',
4 'name.min'=>'The field has to be :min chars long',
5 ];
6
7 $rules = [
8 'email'=>'required|unique:content',
9 'name'=>'required|min:3',
10 ];
11
12$validator = Validator::make($request, $rules,$messsages);