问题:每次尝试Auth :: attempt()
时都会返回falsemyUsersModel.php
library(data.table)#v1.9.5+
modelh <- melt(setDT(exp, keep.rownames=TRUE), measure=patterns('^age', '^h'),
value.name=c('age', 'h'))[, {model <- lm(age ~h)
coef(model)[1] + 100 * coef(model)[2]},rn]$V1
exp[, modelh:= modelh][, rn := NULL]
exp
# exp re age1 age2 h h2 modelh
# 1: A 1 10 30 19.23298 46.67906 68.85506
# 2: A 2 11 31 17.73018 47.55402 66.17050
# 3: A 3 12 32 26.56967 46.69174 84.98486
# 4: A 4 13 33 11.69149 47.74486 61.98766
# 5: A 5 14 34 24.05648 46.10051 82.90167
# 6: A 6 15 35 24.51312 44.85710 89.21053
# 7: A 7 16 36 34.37208 47.85151 113.37492
# 8: A 8 17 37 21.10962 48.40977 74.79483
# 9: A 9 18 38 26.39676 46.74548 90.34187
#10: A 10 19 39 15.10786 45.38862 75.07002
#11: B 1 20 40 28.74989 46.44153 100.54666
#12: B 2 21 41 36.46497 48.64253 125.34773
#13: B 3 22 42 18.41062 45.74346 81.70062
#14: B 4 23 43 21.95464 48.77079 81.20773
#15: B 5 24 44 32.87653 47.47637 115.95097
#16: B 6 25 45 30.07065 48.44727 101.10688
#17: B 7 26 46 16.13836 44.90204 84.31080
#18: B 8 27 47 20.72575 47.14695 87.00805
#19: B 9 28 48 20.78425 48.94782 84.25406
#20: B 10 29 49 30.70872 44.65144 128.39415
myController.php
<?php
use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface;
class myUsersModel extends Eloquent implements UserInterface, RemindableInterface{
use UserTrait, RemindableTrait;
protected $table = 'myUsersTable';
protected $primaryKey = 'primary_key';
public $timestamps = false;
protected $increments = 'primary_key';
protected $fillable = array(
'user', //this is like username
'password', //this one contains hashed password values
'userlevel',
'remember_token',
);
protected $hidden = array('password');
}
auth.php
$attemptData = array(
'user' => Input::get('textBoxInput'),
'password' => Input::get('passwordInput')
);
Auth::attempt($attemptData);
return var_dump(Auth::check());
另一个注意事项:
我记得的令牌是可空的'driver' => 'eloquent',
'model' => 'myUsersModel',
'table' => 'myUsersTable'
2.我的密码字段为varchar(100)
3.我可以使用varchar(60)
来获取表单值
4.在我的数据库中,我有散列和非散列密码值,每个用户都有不同的密码值。但两人都无法登录。
感谢。
答案 0 :(得分:0)
我还没有发布我的整个自定义模型和控制器,但我的模型有一个电子邮件字段,如'user_e_mail'
,并且符合我的身份验证规则的要求,需要进行检查。
这就是问题,我必须覆盖getReminderEmail()
模式下的myUsersModel
方法。
public function getReminderEmail() {
return $this->user_e_mail;
}
所以现在我可以进行身份验证。
感谢。