Laravel - Rate Limiting - Clearing Attempts

You may reset the number of attempts for a given rate limiter key using the clear method. For example, you may reset the number of attempts when a given message is read by the receiver:

    
    use App\Models\Message;
    use Illuminate\Support\Facades\RateLimiter;
    
    /**
     * Mark the message as read.
     *
     * @param  \App\Models\Message  $message
     * @return \App\Models\Message
     */
    public function read(Message $message)
    {
        $message->markAsRead();
    
        RateLimiter::clear('send-message:'.$message->user_id);
    
        return $message;
    }