【问题标题】:Laravel verfication.resend - The GET method is not supported for this route. Supported methods: POSTLaravel verfication.resend - 此路由不支持 GET 方法。支持的方法:POST
【发布时间】:2020-03-21 18:22:15
【问题描述】:

这里有奇怪的问题。我在 Laravel 6 中使用默认的Auth::routes(['verify' => true]);。所以我注册(自定义注册表单)并且一切正常(添加到数据库等)然后我被带到验证页面,其中有一个电子邮件链接可以重新发送。当我点击这个时,我得到:

The GET method is not supported for this route. Supported methods: POST.

视图在链接route('verification.resend')中路由了这个命名

【问题讨论】:

  • 你的问题是什么?
  • 你的链接是什么?你在哪里点击?

标签: laravel authentication


【解决方案1】:

因为在 laravel 6+ 他们将此路线添加为帖子,因此您可以通过以下代码进行操作

<a  onclick="event.preventDefault(); document.getElementById('email-form').submit();">{{ __('click here to request another') }}
</a>.

<form id="email-form" action="{{ route('verification.resend') }}" method="POST" style="display: none;">
                    @csrf
</form>

【讨论】:

    【解决方案2】:

    如您所见here。验证重新发送是 POST 路由。所以 GET 方法是不允许的。所以它应该是一个表单 Post 代替。

    如果你使用刀片,这样的东西会让你到达那里。

    <form method="POST" action="{{ route('verification.resend')) }}">
    </form>
    

    【讨论】:

      猜你喜欢
      • 2021-04-11
      • 2021-08-05
      • 2020-06-05
      • 2021-01-10
      • 2020-04-19
      • 1970-01-01
      • 1970-01-01
      • 2020-09-04
      相关资源
      最近更新 更多