我创建了 2 个页面。首先是编辑个人资料,其次是更改密码,此页面和功能有效。当密码更改和其他输入位于单独的页面上时,所有这些都有效并且所有这些都发生了变化。但是当我尝试将密码更改放在配置文件编辑中时,我收到此错误:
Facade\Ignition\Exceptions\ViewException 未定义变量:用户(查看:/home/mokoch/Bureau/projetabonnementpayant/resources/views/profile/edit.blade.php) http://127.0.0.1:8000/profile
匹配旧密码.php
<?php
namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
use Illuminate\Support\Facades\Hash;
class MatchOldPassword implements Rule
{
/**
* Determine if the validation rule passes.
*
* @param string $attribute
* @param mixed $value
* @return bool
*/
public function passes($attribute, $value)
{
return Hash::check($value, auth()->user()->password);
}
/**
* Get the validation error message.
*
* @return string
*/
public function message()
{
return 'The :attribute is match with old password.';
}
}
慕斯709654