Skip to content

Commit 18cd6ab

Browse files
sethsandarutaylorotwellLukasss93
authored
[12.x] Adds support enums for ThrottleRequests::using method (#57190)
* enabling enum for ThrottleRequests::using * type * ci * Apply suggestion from @Lukasss93 Co-authored-by: Luca Patera <[email protected]> --------- Co-authored-by: Taylor Otwell <[email protected]> Co-authored-by: Luca Patera <[email protected]>
1 parent 3d8ed4e commit 18cd6ab

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Illuminate/Routing/Middleware/ThrottleRequests.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
use RuntimeException;
1414
use Symfony\Component\HttpFoundation\Response;
1515

16+
use function Illuminate\Support\enum_value;
17+
1618
class ThrottleRequests
1719
{
1820
use InteractsWithTime;
@@ -44,12 +46,12 @@ public function __construct(RateLimiter $limiter)
4446
/**
4547
* Specify the named rate limiter to use for the middleware.
4648
*
47-
* @param string $name
49+
* @param \UnitEnum|string $name
4850
* @return string
4951
*/
5052
public static function using($name)
5153
{
52-
return static::class.':'.$name;
54+
return static::class.':'.enum_value($name);
5355
}
5456

5557
/**

0 commit comments

Comments
 (0)