From f88b3a2fb94e248deb362738d7d6804c533a012a Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 4 Dec 2021 17:33:32 -0700 Subject: [PATCH] Update StatusService, add getDirectMessage method --- app/Services/StatusService.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/Services/StatusService.php b/app/Services/StatusService.php index a4cfc4b75..d81d874be 100644 --- a/app/Services/StatusService.php +++ b/app/Services/StatusService.php @@ -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);