1@if($errors->any())
2 <div class="alert alert-danger">
3 <p><strong>Opps Something went wrong</strong></p>
4 <ul>
5 @foreach ($errors->all() as $error)
6 <li>{{ $error }}</li>
7 @endforeach
8 </ul>
9 </div>
10@endif
11
12@if(session('success'))
13 <div class="alert alert-success">{{session('success')}}</div>
14@endif
15
16@if(session('error'))
17 <div class="alert alert-danger">{{session('error')}}</div>
18@endif
19
1 @if ($errors->any())
2 @foreach ($errors->all() as $error)
3 <div>{{$error}}</div>
4 @endforeach
5 @endif
6
1/**
2 * Store a new blog post.
3 *
4 * @param Request $request
5 * @return Response
6 */
7
8public function store(Request $request)
9{
10 $validatedData = $request->validate([
11 'title' => 'required|unique:posts|max:255',
12 'body' => 'required',
13 ]);
14
15 // The blog post is valid...
16}
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);