From 6161cf45aa3cac82151c2d6975b5e7895c32c242 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 1 Aug 2023 05:48:27 -0600 Subject: [PATCH] Add AdminProfile resource --- app/Http/Resources/AdminProfile.php | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 app/Http/Resources/AdminProfile.php diff --git a/app/Http/Resources/AdminProfile.php b/app/Http/Resources/AdminProfile.php new file mode 100644 index 000000000..50db2d5ca --- /dev/null +++ b/app/Http/Resources/AdminProfile.php @@ -0,0 +1,30 @@ + + */ + public function toArray(Request $request): array + { + $res = AccountService::get($this->id, true); + $res['domain'] = $this->domain; + $res['status'] = $this->status; + $res['limits'] = [ + 'exist' => $this->cw || $this->unlisted || $this->no_autolink, + 'autocw' => (bool) $this->cw, + 'unlisted' => (bool) $this->unlisted, + 'no_autolink' => (bool) $this->no_autolink, + 'banned' => (bool) $this->status == 'banned' + ]; + return $res; + } +}