我想使用Laravel 5.2身份验证检查登录信息。
在< 5.2我工作得更轻松了,现在不行...... 这是我的代码......
我没有通过移民来制作桌子......
如下插入值......
...控制器
public function DoLogin(){
$userdata = [
'email' =>Input::get('email'),
'pwd' =>Input::get('pwd')
];
if(Auth::attempt($userdata)){
return "Success";
}else{
return "Error";
}
}
public function insert(){
$data = [
'email' =>'loremlipsum',
'pwd' =>Hash::make('12345'),
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s')
];
DB::table('users')->insert($data);
}
每次收到消息为" 错误"。
1 id int(11) No None AUTO_INCREMENT Change Change Drop Drop
2 email varchar(400) latin1_swedish_ci No None Change Change Drop Drop
3 pwd varchar(400) latin1_swedish_ci No None Change Change Drop Drop
4 created_at timestamp on update CURRENT_TIMESTAMP No CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP Change Change Drop Drop
5 updated_at timestamp No 0000-00-00 00:00:00 Change Change Drop Drop
...表格
<form action="{{URL::to(route('do_login'))}}" method="post">
<input type="text" name="email"><br/><br/><br/>
<input type="password" name="pwd"><br/><br/><br/>
<input type="submit" value="Login">
</form>
记住一件事,我正在使用单表验证,如5.1及以下......
由于