我正在使用Laratrust
包来管理authentification
.
现在我正在尝试添加一个新条件来进行身份验证。
用户应该可以status=1
登录。
所以我使用 laratrust 中定义的函数 autheicate() ,我只是添加列状态来验证身份验证。
所以我有以下代码:
public function authenticate()
{
$this->ensureIsNotRateLimited();
if (! Auth::attempt($this->only('email', 'password','status'->'1'), $this->boolean('remember'))) {
RateLimiter::hit($this->throttleKey());
throw ValidationException::withMessages([
'email' => __('auth.failed'),
]);
}
RateLimiter::clear($this->throttleKey());
}
但我收到以下错误:
syntax error, unexpected ''1'' (T_CONSTANT_ENCAPSED_STRING), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$'
如果您对如何将条件状态添加到我的代码有任何想法,请帮助我。
先感谢您。