我的身份验证::尝试无效。但是我的注册表数据将存储在用户数据库中,并且我还应用了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',
];
}
使用$request-
public function showLoginform(Request $request){
$this->validate($request,[
'email' => 'required',
'password' => 'required',
]);
$user_data = array(
'email' => $request->input('email'),
'password' => $request->input('password')
);
if(Auth::attempt($user_data)){
//return \redirect::to("logged in successfuly");
echo "yes match";
} else{
echo "not match";
// return "oopps something wrong";
}
}