*/ public function toArray(Request $request): array { $res = [ 'id' => $this->id, 'reporter' => AccountService::get($this->profile_id, true), 'type' => $this->type, 'object_id' => (string) $this->object_id, 'object_type' => $this->object_type, 'reported' => AccountService::get($this->reported_profile_id, true), 'status' => null, 'reporter_message' => $this->message, 'admin_seen_at' => $this->admin_seen, 'created_at' => $this->created_at, ]; if ($this->object_id && in_array($this->object_type, [Status::class, 'App\Status'])) { $res['status'] = StatusService::get($this->object_id, false); } if ($this->object_id && $this->object_type === DmMessage::class) { $message = DmMessage::withTrashed()->with('media')->find($this->object_id); if ($message) { $res['direct_message'] = app(DirectMessagePayloadService::class)->message($message, (int) $this->profile_id); } } if ($this->object_id && in_array($this->object_type, [Story::class, 'App\Story'])) { $story = Story::find($this->object_id); if ($story) { $res['story'] = $story->toAdminEntity(); } } return $res; } }