1
0
mirror of https://github.com/flarum/core.git synced 2025-08-18 06:11:23 +02:00

Introduce RequestUtil to encapsulate getting/setting actor on requests(#2449)

This commit is contained in:
Alexander Skvortsov
2021-04-07 23:33:05 -04:00
committed by GitHub
parent da598db376
commit 94d69fe15f
54 changed files with 134 additions and 56 deletions

View File

@@ -26,7 +26,7 @@ class ThrottleApi implements ExtenderInterface
*
* The callable can be a closure or invokable class, and should accept:
* - $request: The current `\Psr\Http\Message\ServerRequestInterface` request object.
* `$request->getAttribute('actor')` can be used to get the current user.
* `\Flarum\Http\RequestUtil::getActor($request)` can be used to get the current user.
* `$request->getAttribute('routeName')` can be used to get the current route.
* Please note that every throttler runs by default on every route.
* If you only want to throttle certain routes, you'll need to check for that inside your logic.