Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
188 views
in Technique[技术] by (71.8m points)

What does Laravel EmailVerification controller's contruct method do?

In the construct method of the default VerificationController.php of Laravel, I see:

    /**
     * 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');
    }

What do these three middlewares do ?

question from:https://stackoverflow.com/questions/65598777/what-does-laravel-emailverification-controllers-contruct-method-do

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
  1. auth middlware makes sure that user is logged in.
  2. singned is related to URL signing, which means attching encrypted data as query param more at: https://laravel.com/docs/8.x/urls#signed-urls
  3. throttle 6,1 means you can't make more than 6 request per minute.

Only means it is applied to only selected controller methods


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...