Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

417
Vistas
:seconds to :hours in Laravel Throttle?

In my

resources/lang/en/auth.php

I have this

<?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.',

];

Is there a way to edit the throttle :seconds to an hour?

the error message on the front would be something like this

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

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

By default, the throttle login trait only give minutes and seconds, if you want to add hours just override sendLockoutResponse method from Illuminate\Foundation\Auth\ThrottlesLogins like below(in LoginController that use AuthenticatesUsers trait ):

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

Now you can add hours throttles like below:

'throttle' => 'Too many login attempts. Please try again in :hours hour(s).',
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda