$validator = Validator::make($request->all(), [ 'name' => 'required|max:255', 'age' => 'required|integer|min:18', 'email' => 'required|email', ]); if ($validator->fails()) { $errors = $validator->errors()->all(); // do something with the errors like display them to the user }In the example above, we use the Validator class to validate the input values from the $request object. If the validation fails, we retrieve the validation errors using the errors() method and store them in an array. We can then display these errors to the user so they know what they need to correct. The Validator class belongs to the Laravel framework package library.