Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: add additional Telescope state check #447

7 changes: 6 additions & 1 deletion src/Guards/AuthenticationGuard.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
*/
final class AuthenticationGuard extends GuardAbstract implements AuthenticationGuardContract
{
/**
* @var string
*/
protected const TELESCOPE = '\Laravel\Telescope\Telescope';

public function find(): ?CredentialEntityContract
{
if ($this->isImpersonating()) {
Expand Down Expand Up @@ -283,7 +288,7 @@ public function user(): ?Authenticatable
* @var ?Authenticatable $lastResponse
*/
// @codeCoverageIgnoreStart
if (class_exists('\Laravel\Telescope\Telescope') && true === config('telescope.enabled')) {
if (class_exists(self::TELESCOPE) && true === config('telescope.enabled')) {
static $depth = 0;
static $lastCalled = null;

Expand Down
2 changes: 1 addition & 1 deletion src/UserProviderAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ final public function retrieveByCredentials(array $credentials): ?Authenticatabl
return $lastResponse;
}

if (class_exists('\Laravel\Telescope\Telescope')) {
if (class_exists(self::TELESCOPE) && true === config('telescope.enabled')) {
static $depth = 0;
static $lastCalled = null;

Expand Down
Loading