Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

420
Views
:segundos a :horas en Laravel Throttle?

En mi

resources/lang/en/auth.php

tengo esto

 <?php return [ /* |-------------------------------------------------------------------------- | Authentication Language Lines |-------------------------------------------------------------------------- | | The following language lines are used during authentication for various | message that we need to display to the user. You are free to modify | these language lines according to your application's requirements. | */ 'failed' => 'These credentials do not match our records.', 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', ];

¿Hay alguna manera de editar el acelerador :seconds a una hora?

el mensaje de error en el frente sería algo como esto

Too many login attempts. Please try again in 2 hour(s).

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

De forma predeterminada, el rasgo de inicio de sesión del acelerador solo proporciona minutes y seconds , si desea agregar horas, simplemente anule el método sendLockoutResponse de Illuminate\Foundation\Auth\ThrottlesLogins como a continuación (en LoginController que usa el rasgo AuthenticatesUsers ):

 /** * Redirect the user after determining they are locked out. * * @param \Illuminate\Http\Request $request * @return void * * @throws \Illuminate\Validation\ValidationException */ protected function sendLockoutResponse(Request $request) { $seconds = $this->limiter()->availableIn( $this->throttleKey($request) ); throw ValidationException::withMessages([ $this->username() => [trans('auth.throttle', [ 'seconds' => $seconds, 'minutes' => ceil($seconds / 60), 'hours' => ceil($seconds / 60 / 60), ])], ])->status(Response::HTTP_TOO_MANY_REQUESTS); }

Ahora puede agregar aceleradores de horas como se muestra a continuación:

 'throttle' => 'Too many login attempts. Please try again in :hours hour(s).',
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!