Update StatusService

This commit is contained in:
Daniel Supernault 2024-09-11 02:53:06 -06:00
parent 1da08feed0
commit 0539018f11
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1

View file

@ -30,9 +30,9 @@ class StatusService
if (! $status) {
return null;
}
$fractal = new Fractal\Manager();
$fractal->setSerializer(new ArraySerializer());
$resource = new Fractal\Resource\Item($status, new StatusStatelessTransformer());
$fractal = new Fractal\Manager;
$fractal->setSerializer(new ArraySerializer);
$resource = new Fractal\Resource\Item($status, new StatusStatelessTransformer);
$res = $fractal->createData($resource)->toArray();
$res['_pid'] = isset($res['account']) && isset($res['account']['id']) ? $res['account']['id'] : null;
if (isset($res['_pid'])) {
@ -112,7 +112,7 @@ class StatusService
{
$status = self::get($id, false);
if (! $status) {
if (! $status || ! $pid) {
return [
'liked' => false,
'shared' => false,
@ -146,9 +146,9 @@ class StatusService
return null;
}
$fractal = new Fractal\Manager();
$fractal->setSerializer(new ArraySerializer());
$resource = new Fractal\Resource\Item($status, new StatusStatelessTransformer());
$fractal = new Fractal\Manager;
$fractal->setSerializer(new ArraySerializer);
$resource = new Fractal\Resource\Item($status, new StatusStatelessTransformer);
return $fractal->createData($resource)->toArray();
}