From 9b4c996cc97a51f87352941154ac566e8177720a Mon Sep 17 00:00:00 2001 From: mpyw Date: Fri, 8 Jun 2018 23:44:12 +0900 Subject: [PATCH] Add GuardHelpers::alreadyAuthenticated() It behave similarly to `GuardHelpers::check()`, but it doesn't trigger any side effects. --- GuardHelpers.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/GuardHelpers.php b/GuardHelpers.php index 9a682c3dc..2bb632ff7 100644 --- a/GuardHelpers.php +++ b/GuardHelpers.php @@ -40,6 +40,16 @@ public function authenticate() throw new AuthenticationException; } + /** + * Determine if the current user is already authenticated without triggering side effects. + * + * @return bool + */ + public function alreadyAuthenticated() + { + return ! is_null($this->user); + } + /** * Determine if the current user is authenticated. *