From 6fc2dd07d4eb679e0401d12510c0c961305071c7 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 15 Oct 2024 04:31:09 -0600 Subject: [PATCH] Add AdminModeratedProfileResource.php --- .../Admin/AdminModeratedProfileResource.php | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 app/Http/Resources/Admin/AdminModeratedProfileResource.php diff --git a/app/Http/Resources/Admin/AdminModeratedProfileResource.php b/app/Http/Resources/Admin/AdminModeratedProfileResource.php new file mode 100644 index 000000000..370145b08 --- /dev/null +++ b/app/Http/Resources/Admin/AdminModeratedProfileResource.php @@ -0,0 +1,41 @@ + + */ + public function toArray(Request $request): array + { + $profileObj = []; + $profile = Profile::withTrashed()->find($this->profile_id); + if($profile) { + $profileObj = [ + 'username' => $profile->username, + ]; + } + return [ + 'id' => $this->id, + 'domain' => $this->domain, + 'profile' => $profileObj, + 'profile_id' => $this->profile_id, + 'profile_url' => $this->profile_url, + 'note' => $this->note, + 'is_banned' => (bool) $this->is_banned, + 'is_nsfw' => (bool) $this->is_nsfw, + 'is_unlisted' => (bool) $this->is_unlisted, + 'is_noautolink' => (bool) $this->is_noautolink, + 'is_nodms' => (bool) $this->is_nodms, + 'is_notrending' => (bool) $this->is_notrending, + 'created_at' => $this->created_at, + ]; + } +}