From 35ee9f2576219dacdd8676d83ce4d5ad6f8e7d3a Mon Sep 17 00:00:00 2001 From: Wisdom Ebong Date: Mon, 4 Dec 2023 11:33:10 +0100 Subject: [PATCH] fix: fallback to null when user attribute value is undefined --- src/Ushahidi/Authzn/GenericUser.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/Ushahidi/Authzn/GenericUser.php b/src/Ushahidi/Authzn/GenericUser.php index 5567601d71..535518af5b 100644 --- a/src/Ushahidi/Authzn/GenericUser.php +++ b/src/Ushahidi/Authzn/GenericUser.php @@ -5,7 +5,6 @@ use Illuminate\Contracts\Auth\Authenticatable as AuthContract; use Laravel\Passport\HasApiTokens; use Ushahidi\Contracts\Entity; -use Ushahidi\Core\Entity\User; class GenericUser implements Entity, AuthContract { @@ -130,7 +129,7 @@ public function asArray() */ public function __get($key) { - return $this->attributes[$key]; + return $this->attributes[$key] ?? null; } /** @@ -166,9 +165,4 @@ public function __unset($key) { unset($this->attributes[$key]); } - - public function generateEntityFromSelf(): User - { - return new User($this->attributes); - } }