From f5c2120eeed2eed89cbf0459b9af9dcf974e191d Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 14 Jan 2023 20:38:33 -0700 Subject: [PATCH] Add AdminUser resource --- app/Http/Resources/AdminUser.php | 44 ++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 app/Http/Resources/AdminUser.php diff --git a/app/Http/Resources/AdminUser.php b/app/Http/Resources/AdminUser.php new file mode 100644 index 00000000..bfbc9e42 --- /dev/null +++ b/app/Http/Resources/AdminUser.php @@ -0,0 +1,44 @@ +profile_id, true); + + $res = [ + 'id' => $this->id, + 'profile_id' => $this->profile_id, + 'name' => $this->name, + 'username' => $this->username, + 'is_admin' => (bool) $this->is_admin, + 'email_verified_at' => $this->email_verified_at, + 'two_factor_enabled' => (bool) $this->{'2fa_enabled'}, + 'register_source' => $this->register_source, + 'last_active_at' => $this->last_active_at, + 'created_at' => $this->created_at, + ]; + + if($account) { + $res['avatar'] = $account['avatar']; + $res['bio'] = $account['note_text']; + $res['statuses_count'] = $account['statuses_count']; + $res['following_count'] = $account['following_count']; + $res['followers_count'] = $account['followers_count']; + $res['is_private'] = $account['locked']; + } + + return $res; + } +}