Update StatusService, add getDirectMessage method

This commit is contained in:
Daniel Supernault 2021-12-04 17:33:32 -07:00
parent fbaed93eda
commit f88b3a2fb9
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -47,6 +47,20 @@ class StatusService {
return $res;
}
public static function getDirectMessage($id)
{
$status = Status::whereScope('direct')->find($id);
if(!$status) {
return null;
}
$fractal = new Fractal\Manager();
$fractal->setSerializer(new ArraySerializer());
$resource = new Fractal\Resource\Item($status, new StatusTransformer());
return $fractal->createData($resource)->toArray();
}
public static function del($id)
{
$status = self::get($id);