1/**
2 * Store a new blog post.
3 *
4 * @param Request $request
5 * @return Response
6 */
7public function store(Request $request)
8{
9 $validatedData = $request->validate([
10 'title' => 'required|unique:posts|max:255',
11 'body' => 'required',
12 ]);
13
14 // The blog post is valid...
15}
1 public function withValidator( $validator )
2 {
3
4 if ( $validator->fails() ) {
5 // Handle errors
6 }
7 ...
8 }
9
10