пожалуйста, помогите им получить эту ошибку при создании страницы входа и регистрации в Laravel 5,1класса «App Validator» не найден Laravel
FatalErrorException in AuthController.php line 44:
Class 'App\Validator' not found
вот мой AuthController.php
<?php
namespace App\Http\Controllers\Auth;
use App\User;
use App\Validator;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ThrottlesLogins;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
class AuthController extends Controller
{
/*
|--------------------------------------------------------------------------
| Registration & Login Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users, as well as the
| authentication of existing users. By default, this controller uses
| a simple trait to add these behaviors. Why don't you explore it?
|
*/
use AuthenticatesAndRegistersUsers, ThrottlesLogins;
/**
* Create a new authentication controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest', ['except' => 'getLogout']);
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|max:255',
'email' => 'required|email|max:255|unique:users',
'password' => 'required|confirmed|min:6',
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return User
*/
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
}
}
и мой зарегистрированный просмотр
<!-- resources/views/auth/register.blade.php -->
<form method="POST" action="/QADapps/auth/register">
{!! csrf_field() !!}
<div>
Name
<input type="text" name="name" value="{{ old('name') }}">
</div>
<div>
Email
<input type="email" name="email" value="{{ old('email') }}">
</div>
<div>
Password
<input type="password" name="password">
</div>
<div>
Confirm Password
<input type="password" name="password_confirmation">
</div>
<div>
<button type="submit">Register</button>
</div>
</form>
все коды из laravel documention. вот почему я не знаю, почему он терпит неудачу. проверьте, где я получаю сообщение об ошибке. спасибо
также это мой маршруты контроллер
// Authentication routes...
Route::get('auth/login', 'Auth\[email protected]');
Route::post('auth/login', 'Auth\[email protected]');
Route::get('auth/logout', 'Auth\[email protected]');
// Registration routes...
Route::get('auth/register', 'Auth\[email protected]');
Route::post('auth/register', 'Auth\[email protected]');
P.S. мое приложение находится под доменом http://localhost:8080/QADapps/auth/register есть ли какая-либо проблема из-за этого? я также двигаться index.php и .htaccess с общественностью в корневой каталог
У вас есть 'Validator' или класс' User' внутри вашей 'app' папки? –
привет, где точное местоположение? – Nixxx27
'приложение/Validator.php'. Если этот файл не существует, вы можете попробовать ответить @delatbabel ниже. –