Laravel Password Reset is not working with custom User model

1

I'm trying to use the Laravel authentication system with some customizations.

This is my User model:

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Support\Facades\DB;

class Usuario extends Authenticatable
{
    use Notifiable;

    protected $table = 'csrh.usuarios'; 

    protected $fillable = [
        'nm_completo',
        'username',
        'password',
        'tp_usuario',
        'status_usuario'
    ];

    protected $hidden = [
        'password'
    ];

    public $timestamps = false;    

    public function servidor()
    {
        return $this->hasOne('CSRH\Servidor', 'id_usuario');
    }    

    public function getEmailForPasswordReset() {            
        return $this->servidor->e_mail;
    }        

    /**
     * Overrides the method to ignore the remember token.
     */
    public function setAttribute($key, $value)
    {
        $isRememberTokenAttribute = $key == $this->getRememberTokenName();
        if (!$isRememberTokenAttribute) {
            parent::setAttribute($key, $value);
        }
    }

}

The user's email is in the 'server' table, in the e_mail field.

When I click on the 'Reset Password' button, I get the following error:

SQLSTATE[42703]: Undefined column: 7 ERRO: coluna "email" não existe
LINE 1: select * from "csrh"."usuarios" where "email" = $1 limit 1
^ (SQL: select * from "csrh"."usuarios" where "email" = 
[email protected] limit 1)

I tried to implement the CanResetPassword contract, but falls into the same problem.

Any ideas?

    
asked by anonymous 06.10.2017 / 12:31

0 answers