Skip to content

Commit 829f003

Browse files
committed
share method
1 parent 54af824 commit 829f003

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

app/Models/Comment.php

+1-8
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public function getAttribute($key)
171171

172172
'pinned' => (bool) $this->getRawAttribute($key),
173173

174-
'disqus_user_data' => $this->getDisqusUserData(),
174+
'disqus_user_data' => $this->getArray($key),
175175
'message_html' => $this->getMessageHtml(),
176176

177177
'commentable',
@@ -306,13 +306,6 @@ protected function newReportableExtraParams(): array
306306
];
307307
}
308308

309-
private function getDisqusUserData(): ?array
310-
{
311-
$value = $this->getRawAttribute('disqus_user_data');
312-
313-
return $value === null ? null : json_decode($value, true);
314-
}
315-
316309
private function getMessageHtml(): ?string
317310
{
318311
return $this->memoize(__FUNCTION__, fn () => markdown($this->message, 'comment'));

app/Models/Traits/FasterAttributes.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function getRawAttribute(string $key)
1616
return $this->attributes[$key] ?? null;
1717
}
1818

19-
protected function getArray(string $key)
19+
protected function getArray(string $key): ?array
2020
{
2121
$value = $this->getRawAttribute($key);
2222

0 commit comments

Comments
 (0)