1public function testAjax(Request $request)
2 {
3 $name = $request->input('name');
4 $validator = Validator::make($request->all(), ['name' => 'required']);
5
6 if ($validator->fails()){
7 $errors = $validator->errors();
8 echo $errors;
9 }
10 else{
11 echo "welcome ". $name;
12 }
13
14 }
15
1@if($errors->any())
2 @foreach ($errors->all() as $error)
3 <div>{{ $error }}</div>
4 @endforeach
5@endif