Php 如何更改LARAVEL 5上身份验证的默认用户名/电子邮件/密码?

Php 如何更改LARAVEL 5上身份验证的默认用户名/电子邮件/密码?,php,laravel,Php,Laravel,我已经在寻找这个东西了,但我对这个很陌生,我不知道如何让它工作。我正在使用一个没有太多更改的项目,因此我有了User.php,但我添加了以下内容: protected $fillable = ['username', 'email', 'password'];//GEN_ID_Usuario /** * The attributes excluded from the model's JSON form. * * @var array */ protected $hidden = ['

我已经在寻找这个东西了,但我对这个很陌生,我不知道如何让它工作。我正在使用一个没有太多更改的项目,因此我有了User.php,但我添加了以下内容:

protected $fillable = ['username', 'email', 'password'];//GEN_ID_Usuario

/**
 * The attributes excluded from the model's JSON form.
 *
 * @var array
 */
protected $hidden = ['password', 'remember_token'];

/**
* The eloquent relation to assigment a "formulario" model.
*
*/

public function getAuthPassword()
{
    return $this->Usu_Contrasenia;
}
我的AuthController是默认的,但我添加了以下内容:

public function authenticate()
{
    $email = $input['email'];
    $password = $input['password']; 
    if (Auth::attempt(array('Usu_Email' => $email, 'Usu_Contrasenia' => 
    $password)))        
    {
        return redirect()->intended('dashboard');
    }
}

默认情况下,项目中的所有其他内容都是默认的,只是尝试使用用户名、电子邮件和密码:Usu_Nombre、Usu_email和Usu Contrasenia。

根据评论交换,尝试以下操作:

public function authenticate()
{
    $email = $input['email'];
    $password = $input['password']; 
    if (Auth::attempt(array('Usu_Email' => $email, 'password' => 
    $password)))        
    {
        return redirect()->intended('dashboard');
    }
}

请记住,必须对存储的密码进行适当的哈希处理,才能使
Auth:attemp()
按预期工作。

我不确定这是否适用于您:更改
Auth::trunt(数组('Usu-Email'=>$Email,'Usu-Contrasenia'=>$password)
Auth::trunt(数组('Usu-Email'=>$Email,'password'=>$password)
.Now
getAuthPassword()
将正确启动。@user2094178和Hardy Mathew我按照你说的做了,这发生了…QueryException in Connection.php第624行:SQLSTATE[42S22]:未找到列:1054 where子句中的未知列“email”(SQL:select count(*)作为来自
Gen_Usuario
的聚合,其中
电子邮件
=melis。inf@gmail.com)保持
'Usu_-Email'
原样。@user2094178如下:公共函数authenticate(){$password=$input['password'];if(Auth::trunt(数组('Usu-Email','password'=>$password)){return redirect()->故意('dashboard');}},因为我这样做了,但仍然得到错误:(我太迷茫了。别忘了,你必须在你的模型中更新
$filleble
$hidden
,以反映对应的表模式。我做到了,我改变了事情,除了我不知道散列,但我希望我甚至可以注册,但我不能…得到相同的错误:SQLSTATE[42S22]:未找到列:1054“where子句”中的未知列“email”(SQL:选择count(*)作为从
Gen\u Usuario
where
email
=melis的聚合。inf@gmail.com)…正如我所说,我对这一点很陌生,所以我不知道:'(但非常感谢您抽出时间。