You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Livewire密码重置组件调用sendResetLink参数类型错误如何解决?

问题原因

Password::sendResetLink() 方法要求第一个参数为键值对数组,你直接传入了Livewire组件的属性$this->email(字符串类型),所以触发了参数类型错误。

解决方案

把传入sendResetLink的参数改成包含email键的数组即可,和官方示例里$request->only('email')的返回结构保持一致,修改后代码如下:

$this->validate();

$status = Password::sendResetLink(
    ['email' => $this->email]
);

return $status === Password::RESET_LINK_SENT
            ? back()->with(['status' => __($status)])
            : back()->withErrors(['email' => __($status)]);

补充说明

官方示例中$request->only('email')的返回值本身就是['email' => '用户输入的邮箱']格式的数组,迁移到Livewire时对应调整参数结构即可正常运行。

内容的提问来源于stack exchange,提问作者SquareNet Media

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.26 20:57:01