getAttributes() as $attribute => $value) { $resource[$attribute] = $value; if ($attribute == 'watchers') { $resource[$attribute] = json_decode($value); } } $resource['tags'] = $this->tagTask()->pluck('tag_id')->toArray(); $resource['works'] = $this->works; $resource['comments'] = $this->comments; return $resource; } }