mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-10 01:03:13 +08:00
Refactor Visitor model and allow a Location object to be passed to it
This commit is contained in:
@@ -18,6 +18,7 @@ use Psr\Http\Message\ServerRequestInterface;
|
||||
use Shlinkio\Shlink\Common\Middleware\IpAddressMiddlewareFactory;
|
||||
use Shlinkio\Shlink\Common\Util\DateRange;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Model\ShortUrlMode;
|
||||
use Shlinkio\Shlink\IpGeolocation\Model\Location;
|
||||
|
||||
use function array_keys;
|
||||
use function array_map;
|
||||
@@ -289,3 +290,8 @@ function ipAddressFromRequest(ServerRequestInterface $request): string|null
|
||||
{
|
||||
return $request->getAttribute(IpAddressMiddlewareFactory::REQUEST_ATTR);
|
||||
}
|
||||
|
||||
function geolocationFromRequest(ServerRequestInterface $request): Location|null
|
||||
{
|
||||
return $request->getAttribute(Location::class);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user