I tried to change default email field for reset password (the email field is in other table that my User model has hasOne
relation to this table, and field name is Email
not email
),
I override method getEmailForPasswordReset
in User
model with field Email
from hasOne
relation from another table.
And now its just refresh the page and nothing happens, its even didn't write reset request with token to password_resets
table.
If I go with the flow route->controller->method, I'm getting to Illuminate\Foundation\Auth\SendsPasswordResetEmails
to method sendResetLinkEmail
and here I think this check $this->validateEmail($request)
doesn't work.
If I doing dd
to $request
before this check I get my request.
Below I've added my image of overriding the getEmailForPasswordReset
method
This is my User model:
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
/**
* Class User
* @package App
*/
class User extends Authenticatable
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'Allowed_Users', 'Email', 'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
protected $table = 'sometable';
protected $primaryKey = 'recordId';
public $timestamps = false;
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
'Allowed_Users' => 'integer',
];
public function property()
{
return $this->hasOne('App\Property', 'id', 'Allowed_Users');
}
public function getEmailForPasswordReset()
{
$user_property = $this->property()->get();
return $user_property[0]->Email;
}
}
Thx for help