Laravel: Trait #39;IlluminateFoundationAuthAuthenticatesAndRegistersUsers#39; not found(Laravel:未找到特征“IlluminateFoundationAuthAuthenticatesAndRegistersUsers)
问题描述
我正在更新到 Laravel 5.4 并在尝试显示登录屏幕时收到以下错误消息.
I'm updating to Laravel 5.4 and am receiving the following error message when trying to display the login screen.
我收到以下错误消息:
找不到特征IlluminateFoundationAuthAuthenticatesAndRegistersUsers"
Trait 'IlluminateFoundationAuthAuthenticatesAndRegistersUsers' not found
这里是 AuthController 类:
Here's is the AuthController class:
<?php
namespace AppHttpControllersAuth;
use AppUser;
use Validator;
use AppHttpControllersController;
use IlluminateFoundationAuthThrottlesLogins;
use IlluminateFoundationAuthAuthenticatesAndRegistersUsers;
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;
/**
* Where to redirect users after login / registration.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Where to redirect users after logout.
*
* @var string
*/
protected $redirectAfterLogout = '/login';
/**
* Create a new authentication controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware($this->guestMiddleware(), ['except' => ['getLogout']]);
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return IlluminateContractsValidationValidator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|max:255',
'email' => 'required|email|max:255|unique:users',
'password' => 'required|min:6|confirmed',
]);
}
/**
* 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']),
]);
}
}
推荐答案
在 laravel 5.4 中,我们在这个特性上有了一些变化.现在我们有两个不同的特征:
with laravel 5.4 we have some changes in this trait. Now we have two different traits:
use IlluminateFoundationAuthRegistersUsers;
use IlluminateFoundationAuthAuthenticatesUsers;
如果你安装一个全新的 5.4 laravel 应用程序,你会看到现在你有 LoginController 和 RegisterController 而不是 AuthController
And if you install a fresh 5.4 laravel application you will see that now you have LoginController and RegisterController instead of AuthController
这篇关于Laravel:未找到特征“IlluminateFoundationAuthAuthenticatesAndRegistersUsers"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Laravel:未找到特征“IlluminateFoundationAuthAuthenticatesAndRegistersUsers"
基础教程推荐
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 在多维数组中查找最大值 2021-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- 超薄框架REST服务两次获得输出 2022-01-01