php - 如果用户使用 Laravel Breeze 处于活动状态,则登录
问题描述
我已经在身份验证函数的 LoginRequest.php 文件中更改了它,但它不起作用。
if (! Auth::attempt($this->only('email', 'password', ['active' => 1]), $this->filled('remember'))) {
RateLimiter::hit($this->throttleKey());
throw ValidationException::withMessages([
'email' => __('auth.failed'),
]);
}
解决方案
该active
部分需要添加到传递给的数组中attempt
,需要与从返回的数组合并only
:
Auth::attempt($this->only('email', 'password') + ['active' => 1]) ...
推荐阅读
- javascript - ChartJS 数据集 onclick 取消选择其余部分
- selenium - 无法使用浏览器堆栈运行我的 Selenium 代码
- python - 勒让德多项式导数
- c++ - Crypto++ 验证大文件签名
- javascript - WebGL 地球:单击地球点时如何从数据库获取数据并在地球上显示弹出窗口
- c# - C# 需要关于阅读大型 Excel 工作簿的建议
- javascript - Materialui 升级“您可能需要适当的加载器来处理此文件类型。” 问题
- pytorch - 在 pyTorch 上执行 RNN 代码时出错?
- javascript - 承诺中的承诺
- r - 使用断点包:“数据错误:仅数据帧”