我已经在routes.php文件
中设置了路由路线:控制器("身份验证","身份验证 AuthController");
Auth/AuthController.php文件是
<?php
namespace AppHttpControllersAuth;
use AppUser;
use Validator;
use AppHttpControllersController;
use IlluminateContractsAuthGuard;
use AppHttpRequestsAuthLoginRequest;
use AppHttpRequestsAuthRegisterRequest;
use IlluminateFoundationAuthThrottlesLogins;
use IlluminateFoundationAuthAuthenticatesAndRegistersUsers;
class AuthController extends Controller
{
use AuthenticatesAndRegistersUsers, ThrottlesLogins;
/**
* the model instance
* @var User
*/
protected $user;
/**
* The Guard implementation.
*
* @var Authenticator
*/
protected $auth;
/**
* Create a new authentication controller instance.
*
* @return void
*/
public function __construct(Guard $auth, User $user)
{
$this->user = $user;
$this->auth = $auth;
$this->middleware('guest', ['except' => ['getLogout']]);
}
/**
* Show the application registration form.
*
* @return Response
*/
public function getRegister()
{
return view('auth.register');
}
/**
* Handle a registration request for the application.
*
* @param RegisterRequest $request
* @return Response
*/
public function postRegister(RegisterRequest $request)
{
//code for registering a user goes here.
$this->auth->login($this->user);
return redirect('/todo');
}
/**
* Show the application login form.
*
* @return Response
*/
public function getLogin()
{
return view('auth.login');
}
/**
* Handle a login request to the application.
*
* @param LoginRequest $request
* @return Response
*/
public function postLogin(LoginRequest $request)
{
if ($this->auth->attempt($request->only('email', 'password')))
{
return redirect('/todo');
}
return redirect('/login')->withErrors([
'email' => 'The credentials you entered did not match our records. Try again?',
]);
}
/**
* Log the user out of the application.
*
* @return Response
*/
public function getLogout()
{
$this->auth->logout();
return redirect('/');
}
}
当我点击这个auth/login时,它给我一个错误——FileViewFinder.php第137行的InvalidArgumentException:视图(身份验证。未找到登录名。有人能帮我解决这个问题吗?
进入
引导/缓存
将config.php重命名为config.php_
我很确定你是从另一个网站复制的,并且移动了缓存
如果你刚开始一个新项目,就没有现成的视图,就像Peter Fox上面提到的。
您需要输入
php artisan make:auth
当我们要进行新的设置时,可能会发生这种情况。先试着清洁
php artisan view:clear
php artisan config:cache
php artisan route:cache
我修改了权限后,我的工作。从/Auth到/Auth的登录目录位于laravel/resources/views/Auth
如果您处于开发模式,您可以运行:
php artisan config:clear
或者如果你在产品模式,你可以运行下面的代码:
php artisan config:cache
注意:当你使用第二,配置清除和缓存再次,你强制重复命令为其他更改。
在目录routes下的web.php文件中,删除或注释Auth::routes();