From 037eb778cafa20ad22570af3b0a5760c54d69271 Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Mon, 12 Aug 2024 14:47:18 -0500 Subject: [PATCH 1/2] add method to determine whether token exists or we need to re-authenticate --- src/Omniphx/Forrest/Client.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Omniphx/Forrest/Client.php b/src/Omniphx/Forrest/Client.php index 754859e..eafb852 100644 --- a/src/Omniphx/Forrest/Client.php +++ b/src/Omniphx/Forrest/Client.php @@ -719,6 +719,16 @@ public function getToken() return $this->tokenRepo->get(); } + /** + * Determine whether token exists + * + * @return bool + */ + public function hasToken() + { + return $this->tokenRepo->has(); + } + /** * Returns any resource that is available to the authenticated * user. Reference Force.com's REST API guide to read about more From 931838da5892f9c89ca8d7c5185b314fa8799466 Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Mon, 12 Aug 2024 14:47:57 -0500 Subject: [PATCH 2/2] document on the facade --- src/Omniphx/Forrest/Providers/Laravel/Facades/Forrest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Omniphx/Forrest/Providers/Laravel/Facades/Forrest.php b/src/Omniphx/Forrest/Providers/Laravel/Facades/Forrest.php index fdf6644..c057560 100644 --- a/src/Omniphx/Forrest/Providers/Laravel/Facades/Forrest.php +++ b/src/Omniphx/Forrest/Providers/Laravel/Facades/Forrest.php @@ -8,6 +8,7 @@ * @method static \Illuminate\Http\RedirectResponse|void authenticate() * @method static void refresh() * @method static \Psr\Http\Message\ResponseInterface|void revoke() + * @method static bool hasToken() * @method static void setCredentials(array $credentials) * @method static string|array versions(array $options = []) * @method static string|array resources(array $options = []) @@ -55,7 +56,7 @@ * @method static string|array actions(string $resource, array $options = []) * @method static string|array support(string $resource, array $options = []) * @method static \Omniphx\Forrest\Interfaces\RedirectInterface callback() -*/ + */ class Forrest extends Facade { /**