【发布时间】:2019-10-15 09:01:55
【问题描述】:
我的 auth:: 尝试不起作用。 但是我的注册表单数据将存储在用户数据库中,并且我还应用了 auth::check(),它也不起作用。
这是控制器
public function showLoginform(Request $request){
$this->validate($request,[
'email' => 'required',
'password' => 'required',
]);
$user_data = array(
'email' => $request->get('email'),
'password' => $request->get('password')
);
if(Auth::attempt($user_data)){
//return \redirect::to("logged in successfuly");
echo "yes match";
} else{
echo "not match";
// return "oopps something wrong";
}
}
这是我的模型
类用户扩展可验证 { 使用通知;
protected $table="users";
protected $fillable = [ 'name', 'email', 'password', 'phonenumber' , 'profession' , 'images' ];
protected $hidden = [
'password', 'remember_token',
];
}
【问题讨论】:
-
您是否对密码进行了哈希处理?您应该散列密码以使用 Auth::attempt
标签: php laravel authentication