Laravel:未找到特征“IlluminateFoundationAuthAuthenticatesAndRegistersUsers"

Laravel: Trait #39;IlluminateFoundationAuthAuthenticatesAndRegistersUsers#39; not found(Laravel:未找到特征“IlluminateFoundationAuthAuthenticatesAndRegistersUsers)
本文介绍了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"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Convert JSON integers and floats to strings(将JSON整数和浮点数转换为字符串)
in php how do I use preg replace to turn a url into a tinyurl(在php中,如何使用preg替换将URL转换为TinyURL)
all day appointment for ics calendar file wont work(ICS日历文件的全天约会不起作用)
trim function is giving unexpected values php(Trim函数提供了意外的值php)
Basic PDO connection to MySQL(到MySQL的基本PDO连接)
PHP number_format returns 1.00(Php number_Format返回1.00)