1
I am 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 table 'server', in the e_mail field.
When I click 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 fell into the same problem.
Any idea?
Welcome, this problem is because you don’t have the spine
email
in your table, in the database, you must create it.– NoobSaibot
Thank you! Although this solves the problem, it is a solution that I would not like to use, not to generate redundancy in my database.
– Aline Rodrigues
You are using
Migrações
?– NoobSaibot
Put the controller on.
– Diego Souza
@Peel Only the migration to the table password_resets, no changes.
– Aline Rodrigues
@Diegosouza am using the authentication controllers that comes with Laravel, no changes.
– Aline Rodrigues