Я использую Auth леса в laravel 5.5.Но когда я пытаюсь зайти в / войти или / зарегистрироваться, я перенаправлен в / домой.Это в моем контроллере входа:
публичная функция входа в систему (запрос $ запроса) {$ this-> validateLogin ($ запрос);
// If the class is using the ThrottlesLogins trait, we can automatically throttle
// the login attempts for this application. We'll key this by the username and
// the IP address of the client making these requests into this application.
if ($this->hasTooManyLoginAttempts($request)) {
$this->fireLockoutEvent($request);
return $this->sendLockoutResponse($request);
}
// Check Whether username or email used
$user = $request->input('user');
$password = $request->input('password');
if (filter_var($user, FILTER_VALIDATE_EMAIL)) {
//email used
if(Auth::attempt(['email' => $user, 'password' => $password, 'ustatus' => 'active'])){
// Check and go to home
$this->sendLoginResponse($request);
return redirect()->intended('user/home');
}
else{
$this->incrementLoginAttempts($request);
return redirect()->back()->withErrors('error','User is invalid');
}
} else {
//username used
if(Auth::attempt(['user_name' => $user, 'password' => $password, 'ustatus' => 'active'])){
// Check and go to home{
$this->sendLoginResponse($request);
return redirect()->intended('user/home');
} else {
$this->incrementLoginAttempts($request);
return redirect()->back()->withErrors('error', 'User is invalid');
}
}
// If the login attempt was unsuccessful we will increment the number of attempts
// to login and redirect the user back to the login form. Of course, when this
// user surpasses their maximum number of attempts they will get locked out.
$this->incrementLoginAttempts($request);
return $this->sendFailedLoginResponse($request);
}
Моя модель пользователя:
class User extends Authenticatable
{
use Notifiable;
protected $primaryKey = "user_id";
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
}
Маршруты:
Auth::routes();
Может кто-нибудь помочь.Заранее спасибо