Laravel电子邮件验证控制器的构造方法有什么作用?



在Laravel的默认VerificationController.phpconstruct方法中,我看到:

/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('signed')->only('verify');
$this->middleware('throttle:6,1')->only('verify', 'resend');
}

这三个中间件是做什么的?

  1. auth-middlware确保用户已登录
  2. singned与URL签名有关,这意味着将加密数据作为查询参数更多地附加在:https://laravel.com/docs/8.x/urls#signed-url
  3. 油门6.1意味着你每分钟不能提出超过6个请求

仅表示它仅适用于选定的控制器方法

最新更新