Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 重新发送电子邮件的功能将我带到主页,并且在给定的函数-Laravel中不做任何操作_Php_Laravel_Authentication - Fatal编程技术网

Php 重新发送电子邮件的功能将我带到主页,并且在给定的函数-Laravel中不做任何操作

Php 重新发送电子邮件的功能将我带到主页,并且在给定的函数-Laravel中不做任何操作,php,laravel,authentication,Php,Laravel,Authentication,我有这个简单的功能,点击发送电子邮件给用户,如果第一个注册后没有去。但是当我点击这个按钮时,它什么也不做,把我带到主页 重发功能: protected function resend() { $user = Account::where('email', Auth::user()->email)->first(); $user->verifyToken = Str::random(40); $user->save()

我有这个简单的功能,点击发送电子邮件给用户,如果第一个注册后没有去。但是当我点击这个按钮时,它什么也不做,把我带到主页

重发功能:

protected function resend()
    {
        $user = Account::where('email', Auth::user()->email)->first();
        $user->verifyToken = Str::random(40);
        $user->save();

        $this->sendEmail($user);
        return redirect(route('verifyEmail'))->with('user',$user)->with('success', 'A link has been sent to your email');

    }
<form action=" {!! route('resendEmail') !!}" method="POST">
   @csrf
      <button class="btn btn-default" type="submit" value="Submit">Resend Verification Link</button>
</form>
Route::post('/ressend/email','Auth\RegisterController@resend')->name('resendEmail')

html:

protected function resend()
    {
        $user = Account::where('email', Auth::user()->email)->first();
        $user->verifyToken = Str::random(40);
        $user->save();

        $this->sendEmail($user);
        return redirect(route('verifyEmail'))->with('user',$user)->with('success', 'A link has been sent to your email');

    }
<form action=" {!! route('resendEmail') !!}" method="POST">
   @csrf
      <button class="btn btn-default" type="submit" value="Submit">Resend Verification Link</button>
</form>

@csrf
重新发送验证链接
通过添加到构造函数解决了中间件问题:
$this->中间件('auth',['except'=>['resendEmail']])

将此添加到注册表控制器上
\u构造方法:


可能是因为在路由中重新发送之前的前导
/
?尝试
Route::post('ressend/email'),…
但是
return redirect(Route('verifyEmail'))->with('user',$user)->with('success','A link has sent to your email');
不应该返回到给定的路由吗?它可能不会影响函数。您可以在函数中添加一些内容来确认。嗯,是的,dd没有显示给我们。