Laravel 5自定义验证尝试

时间:2018-04-08 20:23:44

标签: php laravel lumen

在我的数据库中,我有两个字段,如" userName"," loginName" 但是" loginName"默认情况下总是" NULL"

See Database img here.

我想让用户使用" userName"或" loginName" (loginName可以由用户在将来/系统生成的userName中设置)

c

2 个答案:

答案 0 :(得分:0)

a=(char*)malloc( 100*sizeof(char) );

答案 1 :(得分:0)

$data = [];

if ($request->userName) {
   $data['userName'] = $request->userName;
} 

if ($request->loginName) {
   $data['loginName'] = $request->loginName;
}

$data['password'] = $request->passHash;

if (Auth::attempt($data)) {
  // Do something
}