我无法在 laravel 7 中重设密码
i can't reset password in laravel 7
当我编码 password/reset 时,我发现这个错误: 用户必须实现 CanResetPassword 接口。
我可以手动编写代码或更改我的代码中的某些内容吗?
我找不到问题到底出在哪里,你能帮我吗
我的模型用户是:
<?php
namespace App;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Auth\Passwords\CanResetPassword;
class User extends Authenticatable implements MustVerifyEmail,CanResetPassword
{
use Notifiable;
public function fillier(){
return $this->belongsTo('App\Fillier');
}
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password', 'is_admin', 'is_represantant',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
}
默认包含 L7 中的 CanResetPassword
。您不需要明确实施它。根据文档:
The App\User
model included with the framework already implements this interface
当我编码 password/reset 时,我发现这个错误: 用户必须实现 CanResetPassword 接口。
我可以手动编写代码或更改我的代码中的某些内容吗? 我找不到问题到底出在哪里,你能帮我吗 我的模型用户是:
<?php
namespace App;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Auth\Passwords\CanResetPassword;
class User extends Authenticatable implements MustVerifyEmail,CanResetPassword
{
use Notifiable;
public function fillier(){
return $this->belongsTo('App\Fillier');
}
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password', 'is_admin', 'is_represantant',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
}
CanResetPassword
。您不需要明确实施它。根据文档:
The
App\User
model included with the framework already implements this interface