Hello Devs,

When you get 'App\Http\Controllers\Validator' not found this Exception then use "use Validator" in controller.



use Validator;
namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Validator;

class RegisterController extends Controller
{
    public function store(Request $request)
    {
        $input = $request->all();

        $validator = Validator::make($input, [
           'name' => 'required',
           'email' => 'required',
           'password' => 'required_with:confirm_password|same:confirm_password',
        ]);

        if ($validator->passes()) {
            return true;
        }

        return redirect()->back()
                        ->withErrors($validator)
                        ->withInput();
    }

}


I hope this example helps you.