From eb7651e8ef7ba18c63923fd6a1a6cacd37d43e34 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 24 Feb 2019 23:41:12 -0700 Subject: [PATCH] Update StatusTransformer --- app/Transformer/Api/StatusTransformer.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Transformer/Api/StatusTransformer.php b/app/Transformer/Api/StatusTransformer.php index 16b1a8de0..198a098ff 100644 --- a/app/Transformer/Api/StatusTransformer.php +++ b/app/Transformer/Api/StatusTransformer.php @@ -62,9 +62,10 @@ class StatusTransformer extends Fractal\TransformerAbstract public function includeMediaAttachments(Status $status) { - $media = $status->media()->orderBy('order')->get(); - - return $this->collection($media, new MediaTransformer()); + return Cache::remember('status:transformer:media:attachments:'.$status->id, 1440, function() use($status) { + $media = $status->media()->orderBy('order')->get(); + return $this->collection($media, new MediaTransformer()); + }); } public function includeTags(Status $status)