Skip to content

Commit

Permalink
fix: session storage user_agent
Browse files Browse the repository at this point in the history
  • Loading branch information
addeeandra committed Oct 10, 2024
1 parent d41e631 commit 4347c69
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Storage/SessionStorageHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ class SessionStorageHandler implements Contracts\SessionStorageContract
{
public function saveSessionIpAddress(string $sessionId): void
{
session()->put('ip_address', request()->ip());
if (! session()->has('ip_address')) {
session()->put('ip_address', request()->ip());
}
}

public function saveSessionUserAgent(string $sessionId): void
{
session()->put('user_agent', request()->ip());
if (! session()->has('user_agent')) {
session()->put('user_agent', request()->userAgent());
}
}

/**
Expand All @@ -25,7 +29,7 @@ public function saveSessionUserAgent(string $sessionId): void
*/
public function getSavedIpAddress(string $sessionId): ?string
{
return session()->get('ip_address') ?? null;
return session()->get('ip_address', null);

Check failure on line 32 in src/Storage/SessionStorageHandler.php

View workflow job for this annotation

GitHub Actions / Tests P8.3 - ubuntu-latest

Method Dentro\Paranoia\Storage\SessionStorageHandler::getSavedIpAddress() should return string|null but returns mixed.
}

/**
Expand All @@ -34,7 +38,7 @@ public function getSavedIpAddress(string $sessionId): ?string
*/
public function getSavedUserAgent(string $sessionId): ?string
{
return session()->get('user_agent') ?? null;
return session()->get('user_agent', null);

Check failure on line 41 in src/Storage/SessionStorageHandler.php

View workflow job for this annotation

GitHub Actions / Tests P8.3 - ubuntu-latest

Method Dentro\Paranoia\Storage\SessionStorageHandler::getSavedUserAgent() should return string|null but returns mixed.
}

/**
Expand Down

0 comments on commit 4347c69

Please sign in to comment.