From c9e61007d38f0cd5434551ebd7bf9c2a139f4e61 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 26 Jan 2018 15:36:05 -0600 Subject: [PATCH] support pulling rate limit from the user instance --- src/Illuminate/Routing/Middleware/ThrottleRequests.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Illuminate/Routing/Middleware/ThrottleRequests.php b/src/Illuminate/Routing/Middleware/ThrottleRequests.php index 1050b6669c4a..2a03d967a210 100644 --- a/src/Illuminate/Routing/Middleware/ThrottleRequests.php +++ b/src/Illuminate/Routing/Middleware/ThrottleRequests.php @@ -75,6 +75,10 @@ protected function resolveMaxAttempts($request, $maxAttempts) $maxAttempts = explode('|', $maxAttempts, 2)[$request->user() ? 1 : 0]; } + if (! is_numeric($maxAttempts) && $request->user()) { + $maxAttempts = $request->user()->{$maxAttempts}; + } + return (int) $maxAttempts; }