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}
1unique:table,column,except,idColumn
2
3############## Example : ################
4
5############### For Updating
6//rules
7'email' => 'unique:users,email_address,' . $userId,
8
9############### For Creating
10//rules
11'email' => 'unique:users,email_address',