【问题标题】:Error with Laravel Password ResetLaravel 密码重置错误
【发布时间】:2016-07-11 19:30:10
【问题描述】:

我正在使用 laravel 5.1 ResetsPasswords trait 来实现密码重置。我的用户模型称为“帐户”而不是“用户”。 当我输入我的电子邮件以获取密码重置链接时,我收到错误 Class '\App\User' not found 如何让 laravel 知道我的模型名称是“Account”?

示例代码

帐户.php

   class Account extends \Eloquent  implements AuthenticatableContract,
                                        AuthorizableContract,
                                        CanResetPasswordContract
    {
        use Authenticatable, Authorizable, CanResetPassword;

   /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'accounts';


    }

【问题讨论】:

标签: laravel laravel-5.1


【解决方案1】:

在 config/auth.php 文件中更改身份验证模型。

/*
|--------------------------------------------------------------------------
| Authentication Model
|--------------------------------------------------------------------------
|
| When using the "Eloquent" authentication driver, we need to know which
| Eloquent model should be used to retrieve your users. Of course, it
| is often just the "User" model but you may use whatever you like.
|
*/

'model' => App\User::class,

我猜还有身份验证表。

/*
|--------------------------------------------------------------------------
| Authentication Table
|--------------------------------------------------------------------------
|
| When using the "Database" authentication driver, we need to know which
| table should be used to retrieve your users. We have chosen a basic
| default value but you may easily change it to any table you like.
|
*/

'table' => 'users',

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-03-07
    • 1970-01-01
    • 2019-11-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多