From 318082228e277df7ec53cbcc46fa84f3d7482162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Wed, 22 Mar 2023 00:23:41 +0300 Subject: [PATCH] fixed rate limiter for laravel 10 --- app/Traits/Emails.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Traits/Emails.php b/app/Traits/Emails.php index ce8388a80..633d8ee2f 100644 --- a/app/Traits/Emails.php +++ b/app/Traits/Emails.php @@ -18,14 +18,14 @@ trait Emails $limit_per_month = config('app.throttles.email.month'); $decay_per_month = 60 * 60 * 24 * 30; - $can_send = RateLimiter::attempt($key_per_month, $limit_per_month, fn() => '', $decay_per_month); + $can_send = RateLimiter::attempt($key_per_month, $limit_per_month, fn() => null, $decay_per_month); if ($can_send) { // Check if the user has reached the limit of emails per minute $key_per_minute = 'email-minute:' . user()->id; $limit_per_minute = config('app.throttles.email.minute'); - $can_send = RateLimiter::attempt($key_per_minute, $limit_per_minute, fn() => ''); + $can_send = RateLimiter::attempt($key_per_minute, $limit_per_minute, fn() => null); } if ($can_send) {